Update: I just created ticket #23602 on WordPress trac.
A bug in redirect_canonical
function in /wp-include/canonical.php
incorrectly redirects all requests for http://example.com/page/2?p=123
where 123
is a valid post ID to the home page. Here are few examples of sites that feature this bug:
- ma.tt/page/2/?p=42100
- yoast.com/page/1/?p=61478
- techcrunch.com/page/2/?p=755740
- All WordPress.com and WordPress VIP sites!
I noticed this because of multiple soft 404 errors reported in Google Webmaster Tools:
Judging by the time this was first detected by Google, this bug was likely introduced in WordPress 3.5.1 which was released on January 24, 2013. Looks like there haven’t been any changes to that file since September 2012.
A temporary fix would be to use the template_redirect
filter and remove the p
query variable if the request URI contains page/
and redirect to the archive page:
add_filter( 'redirect_canonical', 'fix_paged_redirects', 10, 2 ); function fix_paged_redirects( $redirect_url, $requested_url ) { if ( strpos( $requested_url, 'page/' ) !== false ) return remove_query_arg( 'p', $requested_url ); return $redirect_url; }
Thanks for highlighting this. I thought this was a problem with my Site alone. I’ll try the temporary fix.