WordPress filter hook · part of WordPress core

wp_safe_redirect_fallback

A WordPress core filter that 17 plugins also fire themselves, running on 4.3M+ sites between them.

“This filter is documented in wp-includes/pluggable.php”

How to use wp_safe_redirect_fallback

It's a filter: your callback receives the value and 1 more argument, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'wp_safe_redirect_fallback', function( $url, $status ) {
	// Change $url here.
	return $url;
}, 10, 2 );

Argument names come from IP Location Block's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

This hook is fired by WordPress core too. Official reference on developer.wordpress.org →

17 plugins that fire wp_safe_redirect_fallback

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. Really Simple Security icon Really Simple Security3+ million installs apply_filters( 'wp_safe_redirect_fallback', admin_url(), 302 ) class-admin.php:636
  2. All-In-One Security (AIOS) icon All-In-One Security (AIOS)1+ million installs apply_filters( 'wp_safe_redirect_fallback', admin_url(), 302 ) classes/wp-security-process-renamed-login-page.php:230
  3. Nextend Social Login and Register icon Nextend Social Login and Register200,000+ installs apply_filters( 'wp_safe_redirect_fallback', admin_url(), 302 ) includes/provider.php:920
  4. Theme My Login icon Theme My Login50,000+ installs apply_filters( 'wp_safe_redirect_fallback', admin_url(), 302 ) includes/functions.php:1206
  5. SmartCrawl SEO checker, analyzer & optimizer icon SmartCrawl SEO checker, analyzer & optimizer10,000+ installs apply_filters( 'wp_safe_redirect_fallback', home_url(), $type ) includes/modules/advanced/redirects/class-controller.php:747
  6. IP Location Block icon IP Location Block10,000+ installs apply_filters( 'wp_safe_redirect_fallback', admin_url(), $status ) src/Support/Util.php:903
  7. IP Geo Block icon IP Geo Block7,000+ installs apply_filters( 'wp_safe_redirect_fallback', admin_url(), $status ) classes/class-ip-geo-block-util.php:506
  8. DefendWP Firewall icon DefendWP Firewall3,000+ installs apply_filters( 'wp_safe_redirect_fallback', admin_url(), $status ) includes/defend-wp-firewall-generic-functions.php:585
  9. AJAX Login and Registration modal popup + inline form icon AJAX Login and Registration modal popup + inline form3,000+ installs apply_filters( 'wp_safe_redirect_fallback', home_url(), 200 ) includes/class-core.php:99
  10. WP Hotelier icon WP Hotelier2,000+ installs apply_filters( 'wp_safe_redirect_fallback', home_url(), 302 ) includes/class-htl-form-functions.php:489
  11. Coupon Creator icon Coupon Creator1,000+ installs apply_filters( 'wp_safe_redirect_fallback', admin_url(), 301 ) plugin-engine/src/Pngx/Install/Setup.php:244
  12. Listdom: AI-powered Business Directory with Classifieds Ads Listings icon Listdom: AI-powered Business Directory with Classifieds Ads Listings1,000+ installs apply_filters( 'wp_safe_redirect_fallback', admin_url(), 302 ) app/includes/shortcodes/auth.php:917
  13. Digilan Token icon Digilan Token50+ installs apply_filters( 'wp_safe_redirect_fallback', admin_url(), 302 ) includes/digilan-provider.php:595
  14. MksDdn Migrate Content icon MksDdn Migrate Content20+ installs apply_filters( 'wp_safe_redirect_fallback', admin_url(), $status ) includes/Admin/Services/NotificationService.php:104
  15. VistaWP icon VistaWP10+ installs apply_filters( 'wp_safe_redirect_fallback', admin_url(), $status ) includes/functions.php:101
  16. Suggest 404 links icon Suggest 404 linksFewer than 10 installs apply_filters( 'wp_safe_redirect_fallback', home_url(), 302 ) templates/public/suggest404links-widget.php:22
  17. Zen Login & Authentication icon Zen Login & AuthenticationFewer than 10 installs apply_filters( 'wp_safe_redirect_fallback', admin_url(), 302 ) includes/helpers.php:81

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.