W3cubDocs

/WordPress

did_action( string $tag )

Retrieve the number of times an action is fired.

Parameters

$tag

(string) (Required) The name of the action hook.

Return

(int) The number of times action hook $tag is fired.

Source

File: wp-includes/plugin.php

function did_action( $tag ) {
	global $wp_actions;

	if ( ! isset( $wp_actions[ $tag ] ) ) {
		return 0;
	}

	return $wp_actions[ $tag ];
}

Changelog

Version Description
2.1.0 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/did_action