Filter hook 'wp_safe_redirect_fallback'

in WP Core File wp-includes/pluggable.php at line 1556

View Source

wp_safe_redirect_fallback

Filter Hook
Description
Filters the redirect fallback URL for when the provided redirect is not safe (local).

Hook Information

File Location wp-includes/pluggable.php View on GitHub
Hook Type Filter
Line Number 1556

Hook Parameters

Type Name Description
string $fallback_url The fallback URL to use by default.
int $status The HTTP response status code to use.

Usage Examples

Basic Usage
<?php
// Hook into wp_safe_redirect_fallback
add_filter('wp_safe_redirect_fallback', 'my_custom_filter', 10, 2);

function my_custom_filter($fallback_url, $status) {
    // Your custom filtering logic here
    return $fallback_url;
}

Source Code Context

wp-includes/pluggable.php:1556 - How this hook is used in WordPress core
<?php
1551  		 * @since 4.3.0
1552  		 *
1553  		 * @param string $fallback_url The fallback URL to use by default.
1554  		 * @param int    $status       The HTTP response status code to use.
1555  		 */
1556  		$fallback_url = apply_filters( 'wp_safe_redirect_fallback', admin_url(), $status );
1557  
1558  		$location = wp_validate_redirect( $location, $fallback_url );
1559  
1560  		return wp_redirect( $location, $status, $x_redirect_by );
1561  	}

PHP Documentation

<?php
/**
		 * Filters the redirect fallback URL for when the provided redirect is not safe (local).
		 *
		 * @since 4.3.0
		 *
		 * @param string $fallback_url The fallback URL to use by default.
		 * @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.