Ticket #16133: 16133.diff
File 16133.diff, 2.3 KB (added by , 13 years ago) |
---|
-
wp-includes/canonical.php
79 79 } 80 80 } 81 81 82 $preg_prefix = ''; 83 82 84 // These tests give us a WP-generated permalink 83 85 if ( is_404() ) { 84 86 … … 150 152 $term_count += count( $tax_query['terms'] ); 151 153 152 154 $obj = $wp_query->get_queried_object(); 155 $taxonomy = get_taxonomy( $obj->taxonomy ); 156 if ( $taxonomy->rewrite ) { 157 $preg_prefix = '(?<!/' . preg_quote( $taxonomy->rewrite['slug'], '#' ). ')'; 158 } 159 153 160 if ( $term_count <= 1 && !empty($obj->term_id) && ( $tax_url = get_term_link((int)$obj->term_id, $obj->taxonomy) ) && !is_wp_error($tax_url) ) { 154 161 if ( !empty($redirect['query']) ) { 155 162 if ( is_category() ) { … … 187 194 188 195 // paging and feeds 189 196 if ( get_query_var('paged') || is_feed() || get_query_var('cpage') ) { 190 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'] ) ) {197 while ( preg_match( "#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?\$#", $redirect['path'] ) || preg_match( "#$preg_prefix/(comments/?)?(feed|rss|rdf|atom|rss2)(/+)?\$#", $redirect['path'] ) || preg_match( "#$preg_prefix/comment-page-[0-9]+(/+)?\$#", $redirect['path'] ) ) { 191 198 // Strip off paging and feed 192 $redirect['path'] = preg_replace("#/$wp_rewrite->pagination_base/?[0-9]+?(/+)? $#", '/', $redirect['path']); // strip off any existing paging193 $redirect['path'] = preg_replace( '#/(comments/?)?(feed|rss2?|rdf|atom)(/+|$)#', '/', $redirect['path']); // strip off feed endings194 $redirect['path'] = preg_replace( '#/comment-page-[0-9]+?(/+)?$#', '/', $redirect['path']); // strip off any existing comment paging199 $redirect['path'] = preg_replace("#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?\$#", '/', $redirect['path']); // strip off any existing paging 200 $redirect['path'] = preg_replace("#$preg_prefix/(comments/?)?(feed|rss2?|rdf|atom)(/+|\$)#", '/', $redirect['path']); // strip off feed endings 201 $redirect['path'] = preg_replace("#$preg_prefix/comment-page-[0-9]+?(/+)?\$#", '/', $redirect['path']); // strip off any existing comment paging 195 202 } 196 203 197 204 $addl_path = '';