remove_filter()
最后更新于:2021-11-27 21:42:06
remove_filter( string$hook_name, callable$callback, int$priority=10)Removes a callback function from a filter hook.
参数
- $hook_name
-
(string) (Required) The filter hook to which the function to be removed is hooked.
- $callback
-
(callable) (Required) The name of the function which should be removed.
- $priority
-
(int) (Optional) The exact priority used when adding the original filter callback.
Default value: 10
响应
(bool) Whether the function existed before it was removed.
源文件
文件: gc-includes/plugin.php
function remove_filter( $hook_name, $callback, $priority = 10 ) {
global $gc_filter;
$r = false;
if ( isset( $gc_filter[ $hook_name ] ) ) {
$r = $gc_filter[ $hook_name ]->remove_filter( $hook_name, $callback, $priority );
if ( ! $gc_filter[ $hook_name ]->callbacks ) {
unset( $gc_filter[ $hook_name ] );
}
}
return $r;
}