Don't hardcode the pagination base. Fixes #12507
git-svn-id: http://svn.automattic.com/wordpress/trunk@15582 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -191,9 +191,9 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
|
||||
if ( !$redirect_url )
|
||||
$redirect_url = $requested_url;
|
||||
$paged_redirect = @parse_url($redirect_url);
|
||||
while ( preg_match( '#/page/?[0-9]+?(/+)?$#', $paged_redirect['path'] ) || preg_match( '#/(comments/?)?(feed|rss|rdf|atom|rss2)(/+)?$#', $paged_redirect['path'] ) || preg_match( '#/comment-page-[0-9]+(/+)?$#', $paged_redirect['path'] ) ) {
|
||||
while ( preg_match( "#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", $paged_redirect['path'] ) || preg_match( '#/(comments/?)?(feed|rss|rdf|atom|rss2)(/+)?$#', $paged_redirect['path'] ) || preg_match( '#/comment-page-[0-9]+(/+)?$#', $paged_redirect['path'] ) ) {
|
||||
// Strip off paging and feed
|
||||
$paged_redirect['path'] = preg_replace('#/page/?[0-9]+?(/+)?$#', '/', $paged_redirect['path']); // strip off any existing paging
|
||||
$paged_redirect['path'] = preg_replace("#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", '/', $paged_redirect['path']); // strip off any existing paging
|
||||
$paged_redirect['path'] = preg_replace('#/(comments/?)?(feed|rss2?|rdf|atom)(/+|$)#', '/', $paged_redirect['path']); // strip off feed endings
|
||||
$paged_redirect['path'] = preg_replace('#/comment-page-[0-9]+?(/+)?$#', '/', $paged_redirect['path']); // strip off any existing comment paging
|
||||
}
|
||||
@@ -212,7 +212,7 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
|
||||
$redirect['query'] = remove_query_arg( 'paged', $redirect['query'] );
|
||||
if ( !is_feed() ) {
|
||||
if ( $paged > 1 && !is_single() ) {
|
||||
$addl_path = ( !empty( $addl_path ) ? trailingslashit($addl_path) : '' ) . user_trailingslashit("page/$paged", 'paged');
|
||||
$addl_path = ( !empty( $addl_path ) ? trailingslashit($addl_path) : '' ) . user_trailingslashit("$wp_rewrite->pagination_base/$paged", 'paged');
|
||||
} elseif ( !is_single() ) {
|
||||
$addl_path = !empty( $addl_path ) ? trailingslashit($addl_path) : '';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user