从过滤器上取下所有挂钩。
remove_all_filters( string $tag , int|bool $priority = false )
参数(Parameters)
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
$tag | (string) | 必需 | 从中移除挂钩的筛选器。 |
$priority | (int | bool) | 可选 | 要删除的优先级号。 |
返回(Return)
(true)完成后是真的。
源码(Source)
/**
* Remove all of the hooks from a filter.
*
* @since 2.7.0
*
* @global array $wp_filter Stores all of the filters
* @global array $merged_filters Merges the filter hooks using this function.
*
* @param string $tag The filter to remove hooks from.
* @param int|bool $priority Optional. The priority number to remove. Default false.
* @return true True when finished.
*/
function remove_all_filters( $tag, $priority = false ) {
global $wp_filter, $merged_filters;
if ( isset( $wp_filter[ $tag ]) ) {
if ( false === $priority ) {
$wp_filter[ $tag ] = array();
} elseif ( isset( $wp_filter[ $tag ][ $priority ] ) ) {
$wp_filter[ $tag ][ $priority ] = array();
}
}
unset( $merged_filters[ $tag ] );
return true;
}
更新版本 | 源码位置 | 使用 | 被使用 |
---|---|---|---|
2.7.0 | wp-includes/plugin.php:301 | 2 | 0 |