wp_safe_redirect_fallback

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

Description

apply_filters( 'wp_safe_redirect_fallback', (string) $admin_url, (int) $status ); 

Parameters (2)

0. $admin_url (string) => admin_url()
The fallback URL to use by default.
1. $status (int)
The redirect status.

Usage

To run the hook, copy the example below.
  1. $admin_url = apply_filters( 'wp_safe_redirect_fallback', $admin_url, $status ); 
  2.  
  3. if ( !empty( $admin_url ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the wp_safe_redirect_fallback callback 
  2. function filter_wp_safe_redirect_fallback( $admin_url, $status ) { 
  3. // make filter magic happen here... 
  4. return $admin_url
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'wp_safe_redirect_fallback', 'filter_wp_safe_redirect_fallback', 10, 2 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'wp_safe_redirect_fallback', 'filter_wp_safe_redirect_fallback', 10, 2 ); 

Defined (1)

The filter is defined in the following location(s).

/wp-includes/pluggable.php  
  1. $location = wp_validate_redirect( $location, apply_filters( 'wp_safe_redirect_fallback', admin_url(), $status ) );