Make WordPress Core

Ticket #42313: 42313.4.diff

File 42313.4.diff, 1.5 KB (added by NathanAtmoz, 8 years ago)

Add $x_redirect_by parameter to wp_redirect()

  • src/wp-includes/pluggable.php

    diff --git a/src/wp-includes/pluggable.php b/src/wp-includes/pluggable.php
    index 9af88a6..a6075ae 100644
    a b if ( ! function_exists( 'wp_redirect' ) ) : 
    11891189         *
    11901190         * @global bool $is_IIS
    11911191         *
    1192          * @param string $location The path or URL to redirect to.
    1193          * @param int    $status   Optional. HTTP response status code to use. Default '302' (Moved Temporarily).
     1192         * @param string $location      The path or URL to redirect to.
     1193         * @param int    $status        Optional. HTTP response status code to use. Default '302' (Moved Temporarily).
     1194         * @param string $x_redirect_by Optional. The application doing the redirect. Default 'WordPress'.
    11941195         * @return bool False if the redirect was cancelled, true otherwise.
    11951196         */
    1196         function wp_redirect( $location, $status = 302 ) {
     1197        function wp_redirect( $location, $status = 302, $x_redirect_by = 'WordPress' ) {
    11971198                global $is_IIS;
    11981199
    11991200                /**
    if ( ! function_exists( 'wp_redirect' ) ) : 
    12371238                 * @param int    $status        Status code to use.
    12381239                 * @param string $location      The path to redirect to.
    12391240                 */
    1240                 $x_redirect_by = apply_filters( 'x_redirect_by', 'WordPress', $status, $location );
     1241                $x_redirect_by = apply_filters( 'x_redirect_by', $x_redirect_by, $status, $location );
    12411242                if ( is_string( $x_redirect_by ) ) {
    12421243                        header( "X-Redirect-By: $x_redirect_by" );
    12431244                }
    if ( ! function_exists( 'wp_text_diff' ) ) : 
    27122713                return $r;
    27132714        }
    27142715endif;
    2715