WordPress.org

Make WordPress Core

Ticket #35794: patch.2.txt

File patch.2.txt, 1.5 KB (added by huyby, 5 years ago)

Patch, no color codes this time :)

Line 
1--- web/wp/wp-includes/canonical.php    2016-02-10 22:55:34.000000000 +0100
2+++ ../ixina-be/web/wp/wp-includes/canonical.php        2013-12-24 19:57:12.000000000 +0100
3@@ -234,11 +234,10 @@
4 
5                // paging and feeds
6                if ( get_query_var('paged') || is_feed() || get_query_var('cpage') ) {
7-            $feedssubpattern = implode('|', array_map(function($val) { return preg_quote($val, '#'); }, $wp_rewrite->feeds));
8-                       while ( preg_match( "#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", $redirect['path'] ) || preg_match( '#/(comments/?)?(' . $feedssubpattern . ')(/+)?$#', $redirect['path'] ) || preg_match( '#/comment-page-[0-9]+(/+)?$#', $redirect['path'] ) ) {
9+                       while ( preg_match( "#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", $redirect['path'] ) || preg_match( '#/(comments/?)?(feed|rss|rdf|atom|rss2)(/+)?$#', $redirect['path'] ) || preg_match( '#/comment-page-[0-9]+(/+)?$#', $redirect['path'] ) ) {
10                                // Strip off paging and feed
11                                $redirect['path'] = preg_replace("#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", '/', $redirect['path']); // strip off any existing paging
12-                               $redirect['path'] = preg_replace('#/(comments/?)?(' . $feedssubpattern . ')(/+|$)#', '/', $redirect['path']); // strip off feed endings
13+                               $redirect['path'] = preg_replace('#/(comments/?)?(feed|rss2?|rdf|atom)(/+|$)#', '/', $redirect['path']); // strip off feed endings
14                                $redirect['path'] = preg_replace('#/comment-page-[0-9]+?(/+)?$#', '/', $redirect['path']); // strip off any existing comment paging
15                        }
16