did_action

Retrieve the number of times an action is fired.

Description

(int) did_action( (string) $tag ); 

Returns (int)

The number of times action hook $tag is fired.

Parameters (1)

0. $tag (string)
The name of the action hook.

Usage

  1. if ( !function_exists( 'did_action' ) ) { 
  2. require_once ABSPATH . WPINC . '/plugin.php'; 
  3.  
  4. // The name of the action hook. 
  5. $tag = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = did_action($tag); 
  9.  

Defined (2)

The function is defined in the following location(s).

/wp-includes/plugin.php  
  1. function did_action($tag) { 
  2. global $wp_actions; 
  3.  
  4. if ( ! isset( $wp_actions[ $tag ] ) ) 
  5. return 0; 
  6.  
  7. return $wp_actions[$tag]; 
/wp-admin/includes/noop.php  
  1. function did_action() {}