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

David Morris dvmorris at gmail.com
Wed Sep 8 14:43:04 UTC 2010


Mike,

That worked great! The only thing I had to change was to add two parameters
to the add_filter() call, for priority and number of arguments. For some
reason, the $requested_url wasn't being sent to my filter without specifying
a 2 for that parameter in the add_filter() call.

Thank you so much for your help,

Dave

On Tue, Sep 7, 2010 at 5:41 PM, Mike Schinkel
<mikeschinkel at newclarity.net>wrote:

> 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.
>
> -Mike
>
>
> 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
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
Dave Morris
http://dave.showviz.net/
http://3dcamphouston.com/


More information about the wp-hackers mailing list