Canonical/Rewrite: After [34492], fix rel="canonical" URLs for paginated posts.

Props wonderboymusic, joostdevalk.
See #11694.


git-svn-id: https://develop.svn.wordpress.org/trunk@34496 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2015-09-24 14:30:00 +00:00
parent 02e1102a5b
commit 04bb8a07d7

View File

@ -3455,8 +3455,14 @@ function rel_canonical() {
$url = get_permalink( $id );
if ( $page = get_query_var('cpage') ) {
$url = get_comments_pagenum_link( $page );
$page = get_query_var( 'page' );
if ( $page ) {
$url = trailingslashit( $url ) . user_trailingslashit( $page, 'single_paged' );
}
$cpage = get_query_var( 'cpage' );
if ( $cpage ) {
$url = get_comments_pagenum_link( $cpage );
}
echo '<link rel="canonical" href="' . esc_url( $url ) . "\" />\n";
}