Making WordPress.org

Changeset 9991


Ignore:
Timestamp:
07/02/2020 06:24:42 AM (4 years ago)
Author:
dd32
Message:

SEO: Canonical: Don't include order and orderby in canonical URLs.

Although the content on the requested URL may differ from that of the canonical, consider it the same page.

Fixes #5256.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/mu-plugins/pub/wporg-seo/canonical.php

    r9872 r9991  
    147147    }
    148148
    149     // Add order/orderby to Archives.
    150     if ( is_archive() || is_search() || is_home() ) {
    151         // Check $wp since `get_query_var()` will return default values too.
    152         if ( !empty( $wp->query_vars[ 'order'] ) && in_array( $wp->query_vars[ 'order'], [ 'asc', 'desc' ], true ) ) {
    153             $url = add_query_arg( 'order', get_query_var( 'order' ), $url );
    154         }
    155         if ( !empty( $wp->query_vars[ 'orderby'] ) ) {
    156             $url = add_query_arg( 'orderby', strtolower( get_query_var( 'orderby' ) ), $url );
    157         }
    158     }
    159 
    160149    $url = apply_filters( 'wporg_canonical_url', $url );
    161150
Note: See TracChangeset for help on using the changeset viewer.