WordPress.org

Making WordPress.org

Changeset 9872


Ignore:
Timestamp:
05/13/2020 06:55:56 AM (7 months ago)
Author:
dd32
Message:

SEO: Canonical: Only include the order param if it's a valid sort value.

See #5173, #5169.

File:
1 edited

Legend:

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

    r9869 r9872  
    150150    if ( is_archive() || is_search() || is_home() ) {
    151151        // Check $wp since `get_query_var()` will return default values too.
    152         if ( !empty( $wp->query_vars[ 'order'] ) ) {
     152        if ( !empty( $wp->query_vars[ 'order'] ) && in_array( $wp->query_vars[ 'order'], [ 'asc', 'desc' ], true ) ) {
    153153            $url = add_query_arg( 'order', get_query_var( 'order' ), $url );
    154154        }
Note: See TracChangeset for help on using the changeset viewer.