Definition:
function has_filter($tag, $function_to_check = false) {}
Check if any filter has been registered for a hook.
Parameters
- string $tag: The name of the filter hook.
- callback $function_to_check: optional. If specified, return the priority of that function on this hook or false if not attached.
Return values
returns:Optionally returns the priority on that hook for the specified function.
Source code
function has_filter($tag, $function_to_check = false) {
global $wp_filter;
$has = !empty($wp_filter[$tag]);
if ( false === $function_to_check || false == $has )
return $has;
if ( !$idx = _wp_filter_build_unique_id($tag, $function_to_check, false) )
return false;
foreach ( (array) array_keys($wp_filter[$tag]) as $priority ) {
if ( isset($wp_filter[$tag][$priority][$idx]) )
return $priority;
}
return false;
}
1931

February 12, 2011 


No comments yet... Be the first to leave a reply!