Make WordPress Core

Changeset 42408


Ignore:
Timestamp:
12/18/2017 01:03:06 AM (7 years ago)
Author:
SergeyBiryukov
Message:

Canonical: Introduce x_redirect_by filter that allows applications to identify themselves via X-Redirect-By header when they're doing a redirect.

Props joostdevalk.
Fixes #42313.

File:
1 edited

Legend:

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

    r42377 r42408  
    12251225        if ( ! $is_IIS && PHP_SAPI != 'cgi-fcgi' ) {
    12261226            status_header( $status ); // This causes problems on IIS and some FastCGI setups
     1227        }
     1228
     1229        /**
     1230         * Filters the X-Redirect-By header.
     1231         *
     1232         * Allows applications to identify themselves when they're doing a redirect.
     1233         *
     1234         * @since 5.0.0
     1235         *
     1236         * @param string $x_redirect_by The application doing the redirect.
     1237         * @param int    $status        Status code to use.
     1238         * @param string $location      The path to redirect to.
     1239         */
     1240        $x_redirect_by = apply_filters( 'x_redirect_by', 'WordPress', $status, $location );
     1241        if ( is_string( $x_redirect_by ) ) {
     1242            header( sprintf( "X-Redirect-By: %s", $x_redirect_by ) );
    12271243        }
    12281244
Note: See TracChangeset for help on using the changeset viewer.