[wp-hackers] Removing the canonical URL redirection for /page/1 in WP 3.0

Mike Schinkel mikeschinkel at newclarity.net
Tue Sep 7 22:41:30 UTC 2010

Hi Dave,

I think you want the redirect_canonical hook.  Here's a skelton showing you what I think you need:

add_filter('redirect_canonical', 'my_redirect_canonical');
function my_redirect_canonical($redirect_url, $requested_url) {
  $do_redirect = true;
  if (/* your expression to detect page not to redirect */) 
    $do_redirect = false;
  return $do_redirect;

Hope this helps.


On Sep 7, 2010, at 6:33 PM, David Morris wrote:

> Is there any way to have WordPress 3.0 not redirect /page/1/ URLs to the
> root URL of the blog?
> 2.9.1 seems to leave that URL alone, and now 3.0 does a 301 redirect. I
> would like to try and keep this URL intact. I started looking into the code
> in wp-includes/canonical.php around line 190 just to get a feel for what's
> going on, but I haven't gotten too far into that code.
> Let me know if you have any ideas. Thanks for your help,
> Dave Morris
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

More information about the wp-hackers mailing list