wp_redirect
Filter HookDescription
Filters the redirect location.Hook Information
File Location |
wp-includes/pluggable.php
View on GitHub
|
Hook Type | Filter |
Line Number | 1411 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$location
|
The path or URL to redirect to. |
int
|
$status
|
The HTTP response status code to use. |
Usage Examples
Basic Usage
<?php
// Hook into wp_redirect
add_filter('wp_redirect', 'my_custom_filter', 10, 2);
function my_custom_filter($location, $status) {
// Your custom filtering logic here
return $location;
}
Source Code Context
wp-includes/pluggable.php:1411
- How this hook is used in WordPress core
<?php
1406 * @since 2.1.0
1407 *
1408 * @param string $location The path or URL to redirect to.
1409 * @param int $status The HTTP response status code to use.
1410 */
1411 $location = apply_filters( 'wp_redirect', $location, $status );
1412
1413 /**
1414 * Filters the redirect HTTP response status code to use.
1415 *
1416 * @since 2.3.0
PHP Documentation
<?php
/**
* Filters the redirect location.
*
* @since 2.1.0
*
* @param string $location The path or URL to redirect to.
* @param int $status The HTTP response status code to use.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-includes/pluggable.php
Related Hooks
Related hooks will be displayed here in future updates.