Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function has_filter($tag, $function_to_check = false) {
- $wp_filter = $GLOBALS['wp_filter'];
- if( false === $function_to_check ) {
- if( empty( $wp_filter[ $tag ] )) return false;
- // Make sure at least one priority has a filter callback
- foreach ( $wp_filter[ $tag ] as $callbacks ) {
- if ( ! empty( $callbacks ) ) {
- return true;
- }
- }
- return false;
- }
- 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;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement