Make WordPress Core

Ticket #42313: 42313.3.diff

File 42313.3.diff, 936 bytes (added by joostdevalk, 8 years ago)

Patch v3, check return value for filter

  • wp-includes/pluggable.php

     
    12131213        if ( !$is_IIS && PHP_SAPI != 'cgi-fcgi' )
    12141214                status_header($status); // This causes problems on IIS and some FastCGI setups
    12151215
     1216        /**
     1217         * Filters the x-redirect-by header, allows applications to identify themselves when they're doing a redirect.
     1218         *
     1219         * @since 5.0
     1220         *
     1221         * @param string $x_redirect_by The application doing the redirect.
     1222         * @param int    $status        Status code to use.
     1223         * @param string $location      The path to redirect to.
     1224         */
     1225        $x_redirect_by = apply_filters( 'x_redirect_by', 'WordPress', $status, $location );
     1226        if ( is_string( $x_redirect_by ) ) {
     1227                header( sprintf( "X-Redirect-By: %s", $x_redirect_by  ) );
     1228        }
     1229
    12161230        header("Location: $location", true, $status);
    12171231
    12181232        return true;