Canonical: Output correct canonical links for paged posts when not using pretty permalinks.

Props peterwilsoncc.
Fixes #34890


git-svn-id: https://develop.svn.wordpress.org/trunk@36096 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse
2015-12-26 04:27:43 +00:00
parent 0df95091ee
commit bb0d1af58f

View File

@@ -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' );