WordPress.org

Make WordPress Core

Changeset 48153


Ignore:
Timestamp:
06/23/2020 11:42:36 PM (3 months ago)
Author:
whyisjake
Message:

Canonical: Ensure that when permalinks are set to a trailing slash, that robots.txt doesn't.

Fixes #48025.

Props Toro_Unit, joostdevalk, SergeyBiryukov.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/canonical.php

    r48072 r48153  
    5959
    6060    if ( is_admin() || is_search() || is_preview() || is_trackback()
    61         || is_robots() || is_favicon()
    62         || ( $is_IIS && ! iis7_supports_permalinks() )
     61        || is_favicon() || ( $is_IIS && ! iis7_supports_permalinks() )
    6362    ) {
    6463        return;
     
    684683    }
    685684
     685    // Even if the permalink structure ends with a slash, remove slash robots.txt.
     686    if ( is_robots() ) {
     687        $redirect['path'] = untrailingslashit( $redirect['path'] );
     688    }
     689
    686690    $compare_original = array( $original['host'], $original['path'] );
    687691
Note: See TracChangeset for help on using the changeset viewer.