current_filter() WordPress Function

The current_filter() function is used to return the name of the current filter or action. This is useful for debugging purposes or for creating conditionals based on the current filter.

current_filter() #

Retrieves the name of the current filter hook.


Return

(string) Hook name of the current filter.


Top ↑

Source

File: wp-includes/plugin.php

function current_filter() {
	global $wp_current_filter;

	return end( $wp_current_filter );
}


Top ↑

Changelog

Changelog
VersionDescription
2.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.