current_filter

The timeline below displays how wordpress function current_filter has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.8

/**
 * Retrieves the name of the current filter hook.
 *
 * @since 2.5.0
 *
 * @global string[] $wp_current_filter Stores the list of current filters with the current one last
 *
 * @return string Hook name of the current filter.
 */
function current_filter()
{
    global $wp_current_filter;
    return end($wp_current_filter);
}

WordPress Version: 5.6

/**
 * Retrieve the name of the current filter or action.
 *
 * @since 2.5.0
 *
 * @global string[] $wp_current_filter Stores the list of current filters with the current one last
 *
 * @return string Hook name of the current filter or action.
 */
function current_filter()
{
    global $wp_current_filter;
    return end($wp_current_filter);
}

WordPress Version: 4.3

/**
 * Retrieve the name of the current filter or action.
 *
 * @since 2.5.0
 *
 * @global array $wp_current_filter Stores the list of current filters with the current one last
 *
 * @return string Hook name of the current filter or action.
 */
function current_filter()
{
    global $wp_current_filter;
    return end($wp_current_filter);
}

WordPress Version: 3.9

/**
 * Retrieve the name of the current filter or action.
 *
 * @since 2.5.0
 *
 * @return string Hook name of the current filter or action.
 */
function current_filter()
{
    global $wp_current_filter;
    return end($wp_current_filter);
}

WordPress Version: 3.7

/**
 * Retrieve the name of the current filter or action.
 *
 * @package WordPress
 * @subpackage Plugin
 * @since 2.5
 *
 * @return string Hook name of the current filter or action.
 */
function current_filter()
{
    global $wp_current_filter;
    return end($wp_current_filter);
}