wp_safe_redirect_fallback

過濾鉤子
apply_filters( 'wp_safe_redirect_fallback', admin_url()
引數
  • (string) $fallback_url The fallback URL to use by default.
    Required:
  • (int) $status The HTTP response status code to use.
    Required:
定義位置
相關勾子
wp_redirectwp_redirect_statusx_redirect_bywidget_form_callbackold_slug_redirect_url
相關方法
wp_safe_redirectwp_mediaelement_fallbackwp_sanitize_redirectwp_rel_callbackwp_validate_redirectwp_redirect
引入
4.3.0
棄用
-

wp_safe_redirect_fallback:這是一個 WordPress 函式,用於在 safe_redirect 函式無法被執行的情況下作為備用的方法。safe_redirect 函式用於安全地重定向到指定 URL。在 safe_redirect 函式無法被執行的情況下,wp_safe_redirect_fallback 函式可以作為備用方案,以確保安全地重定向。

過濾當所提供的重定向不安全(本地)時的重定向後備URL。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$location = wp_validate_redirect( $location, apply_filters( 'wp_safe_redirect_fallback', admin_url(), $status ) );
$location = wp_validate_redirect( $location, apply_filters( 'wp_safe_redirect_fallback', admin_url(), $status ) );
$location = wp_validate_redirect( $location, apply_filters( 'wp_safe_redirect_fallback', admin_url(), $status ) );

常見問題

FAQs
檢視更多 >