Title: x_redirect_by
Published: February 22, 2019
Last modified: February 24, 2026

---

# apply_filters( ‘x_redirect_by’, string|false $x_redirect_by, int $status, string $location )

## In this article

 * [Description](https://developer.wordpress.org/reference/hooks/x_redirect_by/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/hooks/x_redirect_by/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/x_redirect_by/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/x_redirect_by/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/x_redirect_by/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/hooks/x_redirect_by/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/hooks/x_redirect_by/?output_format=md#wp--skip-link--target)

Filters the X-Redirect-By header.

## 󠀁[Description](https://developer.wordpress.org/reference/hooks/x_redirect_by/?output_format=md#description)󠁿

Allows applications to identify themselves when they’re doing a redirect.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/x_redirect_by/?output_format=md#parameters)󠁿

 `$x_redirect_by`string|false

The application doing the redirect or false to omit the header.

`$status`int

Status code to use.

`$location`string

The path to redirect to.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/x_redirect_by/?output_format=md#source)󠁿

    ```php
    $x_redirect_by = apply_filters( 'x_redirect_by', $x_redirect_by, $status, $location );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/pluggable.php#L1529)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/pluggable.php#L1529-L1529)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/x_redirect_by/?output_format=md#related)󠁿

| Used by | Description | 
| [wp_redirect()](https://developer.wordpress.org/reference/functions/wp_redirect/)`wp-includes/pluggable.php` |

Redirects to another page.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/x_redirect_by/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/hooks/x_redirect_by/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/hooks/x_redirect_by/?output_format=md#comment-content-3207)
 2.   [ramon fincken](https://profiles.wordpress.org/ramon-fincken/)  [  7 years ago  ](https://developer.wordpress.org/reference/hooks/x_redirect_by/#comment-3207)
 3. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fx_redirect_by%2F%23comment-3207)
    Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fx_redirect_by%2F%23comment-3207)
 4. a word of caution: it SHOULD return a string.
 5. If you don’t return a string .. the header will not be shown
     This can be seen 
    in the pluggable.php wp_redirect function
 6.     ```php
        $x_redirect_by = apply_filters( 'x_redirect_by', $x_redirect_by, $status, $location );
        		if ( is_string( $x_redirect_by ) ) {
        			header( "X-Redirect-By: $x_redirect_by" );
        		}
        ```
    
 7.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fx_redirect_by%2F%3Freplytocom%3D3207%23feedback-editor-3207)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fx_redirect_by%2F)
before being able to contribute a note or feedback.