WordPress.org

Make WordPress Core

Ticket #35794: patch.txt

File patch.txt, 1.7 KB (added by huyby, 4 years ago)

patch

Line 
1[1;33mdiff --git a/wp/wp-includes/canonical.php b/wp/wp-includes/canonical.php[m
2[1;33mindex 9a2a8e9..5aefe2b 100644[m
3[1;33m--- a/wp/wp-includes/canonical.php[m
4[1;33m+++ b/wp/wp-includes/canonical.php[m
5[1;35m@@ -234,11 +234,10 @@[m [mfunction redirect_canonical( $requested_url = null, $do_redirect = true ) {[m
6
7                // paging and feeds[m
8                if ( get_query_var('paged') || is_feed() || get_query_var('cpage') ) {[m
9[31m$feedssubpattern = implode('|', array_map(function($val) { return preg_quote($val, '#'); }, $wp_rewrite->feeds));[m                       while ( preg_match( "#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", $redirect['path'] ) || preg_match( [31m'#/(comments/?)?(' . $feedssubpattern . ')(/+)?$#',[m[32m'#/(comments/?)?(feed|rss|rdf|atom|rss2)(/+)?$#',[m $redirect['path'] ) || preg_match( '#/comment-page-[0-9]+(/+)?$#', $redirect['path'] ) ) {
10                                // Strip off paging and feed[m
11                                $redirect['path'] = preg_replace("#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", '/', $redirect['path']); // strip off any existing paging[m
12                                $redirect['path'] = [31mpreg_replace('#/(comments/?)?(' . $feedssubpattern . ')(/+|$)#',[m[32mpreg_replace('#/(comments/?)?(feed|rss2?|rdf|atom)(/+|$)#',[m '/', $redirect['path']); // strip off feed endings
13                                $redirect['path'] = preg_replace('#/comment-page-[0-9]+?(/+)?$#', '/', $redirect['path']); // strip off any existing comment paging[m
14                        }[m
15
16[1;35m@@ -456,7 +455,7 @@[m [mfunction redirect_canonical( $requested_url = null, $do_redirect = true ) {[m
17                        exit();[m
18                } else {[m
19                        // Debug[m
20                        [32m//[m die("1: $redirect_url<br />2: " . redirect_canonical( $redirect_url, false ) );
21                        return false;[m
22                }[m
23        } else {[m