From 67c5150ba6a6a237a2665fdaa3e81fbb03822ecc Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Sat, 26 Dec 2015 04:28:26 +0000 Subject: [PATCH] Canonical: Output correct canonical links for paged posts when not using pretty permalinks. Props peterwilsoncc. Fixes #34890 Built from https://develop.svn.wordpress.org/trunk@36096 git-svn-id: http://core.svn.wordpress.org/trunk@36061 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/link-template.php | 8 ++++++-- wp-includes/version.php | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index ca6ccfcf88..b580a0a8a2 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -3502,8 +3502,12 @@ function rel_canonical() { $url = get_permalink( $id ); $page = get_query_var( 'page' ); - if ( $page ) { - $url = trailingslashit( $url ) . user_trailingslashit( $page, 'single_paged' ); + if ( $page >= 2 ) { + if ( '' == get_option( 'permalink_structure' ) ) { + $url = add_query_arg( 'page', $page, $url ); + } else { + $url = trailingslashit( $url ) . user_trailingslashit( $page, 'single_paged' ); + } } $cpage = get_query_var( 'cpage' ); diff --git a/wp-includes/version.php b/wp-includes/version.php index e50940da7b..6ede34a650 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.5-alpha-36095'; +$wp_version = '4.5-alpha-36096'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.