From 9405b8b10e126f9a6f7eba42b5427d191ff58d84 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Thu, 24 Sep 2015 14:30:24 +0000 Subject: [PATCH] Canonical/Rewrite: After [34492], fix `rel="canonical"` URLs for paginated posts. Props wonderboymusic, joostdevalk. See #11694. Built from https://develop.svn.wordpress.org/trunk@34496 git-svn-id: http://core.svn.wordpress.org/trunk@34460 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/link-template.php | 10 ++++++++-- wp-includes/version.php | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index 9d9fc00ad7..d6815ad9a3 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -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 '\n"; } diff --git a/wp-includes/version.php b/wp-includes/version.php index dbbae2fe20..5bca848f46 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-34495'; +$wp_version = '4.4-alpha-34496'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.