did_filter( string $hook_name ): int

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


Parameters

$hook_name string Required
The name of the filter hook.

Top ↑

Return

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


Top ↑

Source

File: wp-includes/plugin.php. View all references

function did_filter( $hook_name ) {
	global $wp_filters;

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

	return $wp_filters[ $hook_name ];
}

Top ↑

Changelog

Changelog
Version Description
6.1.0 Introduced.

Top ↑

User Contributed Notes

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