remove_all_filters()

从过滤器上取下所有挂钩。

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.0wp-includes/plugin.php:30120
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索