WordPress.org

Make WordPress Core

Ticket #7942: 7942.3.diff

File 7942.3.diff, 1.1 KB (added by DD32, 5 years ago)

redirect post-name/comment-page-xx/ => post-name/ when paging disabled

  • wp-includes/canonical.php

     
    149149                        if ( is_feed() ) { 
    150150                                $paged_redirect['path'] = user_trailingslashit( trailingslashit( $paged_redirect['path'] ) . 'feed/' . ( ( 'rss2' ==  get_query_var('feed') || 'feed' == get_query_var('feed') ) ? '' : get_query_var('feed') ), 'feed' ); 
    151151                        } 
    152                         if ( ( 'newest' == get_option('default_comments_page') && get_query_var('cpage') > 0 ) || ( 'newest' != get_option('default_comments_page') && get_query_var('cpage') > 1 ) ) { 
     152                        if ( get_option('page_comments') && ( ( 'newest' == get_option('default_comments_page') && get_query_var('cpage') > 0 ) || ( 'newest' != get_option('default_comments_page') && get_query_var('cpage') > 1 ) ) ) { 
    153153                                $paged_redirect['path'] = user_trailingslashit( trailingslashit( $paged_redirect['path'] ) . 'comment-page-' . get_query_var('cpage'), 'commentpaged' ); 
    154154                        } 
    155155                        $redirect_url = $paged_redirect['scheme'] . '://' . $paged_redirect['host'] . $paged_redirect['path'];