Ticket #11248: 11248.2.patch
| File 11248.2.patch, 1.9 KB (added by , 11 years ago) |
|---|
-
src/wp-includes/canonical.php
319 319 } 320 320 321 321 if ( ( 'newest' == get_option('default_comments_page') && get_query_var('cpage') > 0 ) || ( 'newest' != get_option('default_comments_page') && get_query_var('cpage') > 1 ) ) { 322 $addl_path = ( !empty( $addl_path ) ? trailingslashit($addl_path) : '' ) . user_trailingslashit( $wp_rewrite->comments_pagination_base . '-' . get_query_var('cpage'), 'commentpaged' ); 323 $redirect['query'] = remove_query_arg( 'cpage', $redirect['query'] ); 322 if ( $wp_query->post ) { 323 $total_comment_pages = get_comment_pages_count( get_comments( 'post_id=' . $wp_query->post->ID ) ); 324 if ( get_query_var('cpage') <= $total_comment_pages ) { 325 $addl_path = ( !empty( $addl_path ) ? trailingslashit($addl_path) : '' ) . user_trailingslashit( $wp_rewrite->comments_pagination_base . '-' . get_query_var('cpage'), 'commentpaged' ); 326 $redirect['query'] = remove_query_arg( 'cpage', $redirect['query'] ); 327 } 328 } 324 329 } 325 330 326 331 $redirect['path'] = user_trailingslashit( preg_replace('|/' . preg_quote( $wp_rewrite->index, '|' ) . '/?$|', '/', $redirect['path']) ); // strip off trailing /index.php/ -
tests/phpunit/tests/canonical.php
102 102 103 103 // Comments 104 104 array( '/2008/03/03/comment-test/?cpage=2', '/2008/03/03/comment-test/comment-page-2/' ), 105 array( '/2008/03/03/comment-test/comment-page-4/', '/2008/03/03/comment-test/' ), 105 106 106 107 // Attachments 107 108 array( '/?attachment_id=611', '/2008/06/10/post-format-test-gallery/canola2/' ),