remove_all_filters()
remove_all_filters( string $tag, int|bool $priority = f…
remove_all_filters( string $tag, int|bool $priority = false )
从过滤器上取下所有挂钩。
Remove all of the hooks from a filter.
目录锚点:#参数#返回#源码#笔记
参数(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 |
笔记(Notes)
例子:
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。





还没有任何评论,赶紧来占个楼吧!