did_filter

函式
did_filter ( $hook_name )
引數
  • (string) $hook_name The name of the filter hook.
    Required:
返回值
  • (int) The number of times the filter hook has been applied.
定義位置
相關方法
add_filterdoing_filterhas_filterwp_list_filtervalidate_file
引入
6.1.0
棄用
-

did_filter是一個WordPress的函式,用來確定某個過濾器是否已經被應用: 這個函式把一個過濾器的名字作為引數,並返回一個布林值,表示該過濾器是否已經被應用。

檢索在當前請求中應用過濾器的次數。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function did_filter( $hook_name ) {
global $wp_filters;
if ( ! isset( $wp_filters[ $hook_name ] ) ) {
return 0;
}
return $wp_filters[ $hook_name ];
}
function did_filter( $hook_name ) { global $wp_filters; if ( ! isset( $wp_filters[ $hook_name ] ) ) { return 0; } return $wp_filters[ $hook_name ]; }
function did_filter( $hook_name ) {
	global $wp_filters;

	if ( ! isset( $wp_filters[ $hook_name ] ) ) {
		return 0;
	}

	return $wp_filters[ $hook_name ];
}

常見問題

FAQs
檢視更多 >