did_filter( string $hook_name ): int

In this article

Retrieves the number of times a filter has been applied during the current request.

Parameters

$hook_namestringrequired
The name of the filter hook.

Return

int The number of times the filter hook has been applied.

Source

function did_filter( $hook_name ) {
	global $wp_filters;

	if ( ! isset( $wp_filters[ $hook_name ] ) ) {
		return 0;
	}

	return $wp_filters[ $hook_name ];
}

Changelog

VersionDescription
6.1.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.