clean_url

函式
clean_url ( $url, $protocols = null, $context = 'display' )
引數
  • (string) $url The URL to be cleaned.
    Required:
  • (array) $protocols Optional. An array of acceptable protocols.
    Required:
    Default: null
  • (string) $context Optional. How the URL will be used. Default is 'display'.
    Required:
    Default: 'display'
返回值
  • (string) The cleaned $url after the {@see 'clean_url'} filter is applied.
相關
  • esc_url()
定義位置
相關方法
clean_preincludes_urladmin_urlget_admin_urlclean_user_cache
引入
1.2.0
棄用
3.0.0

clean_url: 這個函式用於清理特定URL的快取: 當這個函式被呼叫時,以一個URL為引數,它清除了該特定URL的快取。

檢查和清理一個URL。

一些字元被從URL中刪除。如果該URL是用於顯示的(預設行為),安培數也會被替換。’clean_url’過濾器被應用於返回的已清理的URL。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function clean_url( $url, $protocols = null, $context = 'display' ) {
if ( $context == 'db' )
_deprecated_function( 'clean_url( $context = 'db' )', '3.0.0', 'sanitize_url()' );
else
_deprecated_function( __FUNCTION__, '3.0.0', 'esc_url()' );
return esc_url( $url, $protocols, $context );
}
function clean_url( $url, $protocols = null, $context = 'display' ) { if ( $context == 'db' ) _deprecated_function( 'clean_url( $context = 'db' )', '3.0.0', 'sanitize_url()' ); else _deprecated_function( __FUNCTION__, '3.0.0', 'esc_url()' ); return esc_url( $url, $protocols, $context ); }
function clean_url( $url, $protocols = null, $context = 'display' ) {
	if ( $context == 'db' )
		_deprecated_function( 'clean_url( $context = 'db' )', '3.0.0', 'sanitize_url()' );
	else
		_deprecated_function( __FUNCTION__, '3.0.0', 'esc_url()' );
	return esc_url( $url, $protocols, $context );
}

常見問題

FAQs
檢視更多 >