diff --git a/wp/wp-includes/canonical.php b/wp/wp-includes/canonical.php index 9a2a8e9..5aefe2b 100644 --- a/wp/wp-includes/canonical.php +++ b/wp/wp-includes/canonical.php @@ -234,11 +234,10 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) { // paging and feeds if ( get_query_var('paged') || is_feed() || get_query_var('cpage') ) { $feedssubpattern = implode('|', array_map(function($val) { return preg_quote($val, '#'); }, $wp_rewrite->feeds)); while ( preg_match( "#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", $redirect['path'] ) || preg_match( '#/(comments/?)?(' . $feedssubpattern . ')(/+)?$#','#/(comments/?)?(feed|rss|rdf|atom|rss2)(/+)?$#', $redirect['path'] ) || preg_match( '#/comment-page-[0-9]+(/+)?$#', $redirect['path'] ) ) { // Strip off paging and feed $redirect['path'] = preg_replace("#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", '/', $redirect['path']); // strip off any existing paging $redirect['path'] = preg_replace('#/(comments/?)?(' . $feedssubpattern . ')(/+|$)#',preg_replace('#/(comments/?)?(feed|rss2?|rdf|atom)(/+|$)#', '/', $redirect['path']); // strip off feed endings $redirect['path'] = preg_replace('#/comment-page-[0-9]+?(/+)?$#', '/', $redirect['path']); // strip off any existing comment paging } @@ -456,7 +455,7 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) { exit(); } else { // Debug // die("1: $redirect_url
2: " . redirect_canonical( $redirect_url, false ) ); return false; } } else {