x_redirect_by
Filter HookDescription
Filters the X-Redirect-By header. Allows applications to identify themselves when they're doing a redirect.Hook Information
File Location |
wp-includes/pluggable.php
View on GitHub
|
Hook Type | Filter |
Line Number | 1448 |
Hook Parameters
Type | Name | Description |
---|---|---|
string|false
|
$x_redirect_by
|
The application doing the redirect or false to omit the header. |
int
|
$status
|
Status code to use. |
string
|
$location
|
The path to redirect to. |
Usage Examples
Basic Usage
<?php
// Hook into x_redirect_by
add_filter('x_redirect_by', 'my_custom_filter', 10, 3);
function my_custom_filter($x_redirect_by, $status, $location) {
// Your custom filtering logic here
return $x_redirect_by;
}
Source Code Context
wp-includes/pluggable.php:1448
- How this hook is used in WordPress core
<?php
1443 *
1444 * @param string|false $x_redirect_by The application doing the redirect or false to omit the header.
1445 * @param int $status Status code to use.
1446 * @param string $location The path to redirect to.
1447 */
1448 $x_redirect_by = apply_filters( 'x_redirect_by', $x_redirect_by, $status, $location );
1449 if ( is_string( $x_redirect_by ) ) {
1450 header( "X-Redirect-By: $x_redirect_by" );
1451 }
1452
1453 header( "Location: $location", true, $status );
PHP Documentation
<?php
/**
* Filters the X-Redirect-By header.
*
* Allows applications to identify themselves when they're doing a redirect.
*
* @since 5.1.0
*
* @param string|false $x_redirect_by The application doing the redirect or false to omit the header.
* @param int $status Status code to use.
* @param string $location The path to redirect to.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-includes/pluggable.php
Related Hooks
Related hooks will be displayed here in future updates.