Advertisement
Guest User

Untitled

a guest
May 2nd, 2015
400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.64 KB | None | 0 0
  1. <?php
  2. function has_filter($tag, $function_to_check = false) {
  3.     $wp_filter = $GLOBALS['wp_filter'];
  4.  
  5.     if( false === $function_to_check ) {
  6.         if( empty( $wp_filter[ $tag ] )) return false;
  7.  
  8.         // Make sure at least one priority has a filter callback
  9.         foreach ( $wp_filter[ $tag ] as $callbacks ) {
  10.             if ( ! empty( $callbacks ) ) {
  11.                 return true;
  12.             }
  13.         }
  14.  
  15.         return false;
  16.     }
  17.  
  18.     if ( ! $idx = _wp_filter_build_unique_id( $tag, $function_to_check, false ) )
  19.         return false;
  20.  
  21.     foreach ( (array) array_keys( $wp_filter[$tag]) as $priority ) {
  22.         if ( isset( $wp_filter[$tag][$priority][$idx] ) )
  23.             return $priority;
  24.     }
  25.  
  26.     return false;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement