Related Docs

Did not find what you're looking for? Search the complete TukuToi Software Documentation

Filter

Show all actions and filters run on current queried object

This is an advanced class helpful when debugging issues on WordPress with themes and plugins.

Add it to a theme’s function.php and load any page, or perform any action (for example you can die() a cred_save_data() to see what’s hooked in this moment, etc).

Scroll to the bottom of the page to see the hooked actions and filters.

class MyTracker {

  static $hooks;

  static function track_hooks( ) {
    $filter = current_filter();
    if ( ! empty($GLOBALS['wp_filter'][$filter]) ) {
      foreach ( $GLOBALS['wp_filter'][$filter] as $priority => $tag_hooks ) {
        foreach ( $tag_hooks as $hook ) {
          if ( is_array($hook['function']) )  {
            if ( is_object($hook['function'][0]) ) {
              $func = get_class($hook['function'][0]) . '->' . $hook['function'][1];
            } elseif ( is_string($hook['function'][0]) ) {
              $func = $hook['function'][0] . '::' . $hook['function'][1];
            }
          } elseif( $hook['function'] instanceof Closure ) {
            $func = 'a closure';
          } elseif( is_string($hook['function']) ) {
            $func = $hook['function'];
          }
          self::$hooks[] = 'On hook "' . $filter . '" run '. $func . ' at priority ' . $priority;
        }
      }
    }
  }

}

add_action( 'all', array('MyTracker', 'track_hooks') );

add_action( 'shutdown', function() {
    echo implode( '
', MyTracker::$hooks );
}, 9999);