_deprecated_hook

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

WordPress Version: 6.4

/**
 * Marks a deprecated action or filter hook as deprecated and throws a notice.
 *
 * Use the {@see 'deprecated_hook_run'} action to get the backtrace describing where
 * the deprecated hook was called.
 *
 * Default behavior is to trigger a user error if `WP_DEBUG` is true.
 *
 * This function is called by the do_action_deprecated() and apply_filters_deprecated()
 * functions, and so generally does not need to be called directly.
 *
 * @since 4.6.0
 * @since 5.4.0 The error type is now classified as E_USER_DEPRECATED (used to default to E_USER_NOTICE).
 * @access private
 *
 * @param string $hook        The hook that was used.
 * @param string $version     The version of WordPress that deprecated the hook.
 * @param string $replacement Optional. The hook that should have been used. Default empty string.
 * @param string $message     Optional. A message regarding the change. Default empty.
 */
function _deprecated_hook($hook, $version, $replacement = '', $message = '')
{
    /**
     * Fires when a deprecated hook is called.
     *
     * @since 4.6.0
     *
     * @param string $hook        The hook that was called.
     * @param string $replacement The hook that should be used as a replacement.
     * @param string $version     The version of WordPress that deprecated the argument used.
     * @param string $message     A message regarding the change.
     */
    do_action('deprecated_hook_run', $hook, $replacement, $version, $message);
    /**
     * Filters whether to trigger deprecated hook errors.
     *
     * @since 4.6.0
     *
     * @param bool $trigger Whether to trigger deprecated hook errors. Requires
     *                      `WP_DEBUG` to be defined true.
     */
    if (WP_DEBUG && apply_filters('deprecated_hook_trigger_error', true)) {
        $message = empty($message) ? '' : (' ' . $message);
        if ($replacement) {
            $message = sprintf(
                /* translators: 1: WordPress hook name, 2: Version number, 3: Alternative hook name. */
                __('Hook %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'),
                $hook,
                $version,
                $replacement
            ) . $message;
        } else {
            $message = sprintf(
                /* translators: 1: WordPress hook name, 2: Version number. */
                __('Hook %1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'),
                $hook,
                $version
            ) . $message;
        }
        wp_trigger_error('', $message, E_USER_DEPRECATED);
    }
}

WordPress Version: 6.2

/**
 * Marks a deprecated action or filter hook as deprecated and throws a notice.
 *
 * Use the {@see 'deprecated_hook_run'} action to get the backtrace describing where
 * the deprecated hook was called.
 *
 * Default behavior is to trigger a user error if `WP_DEBUG` is true.
 *
 * This function is called by the do_action_deprecated() and apply_filters_deprecated()
 * functions, and so generally does not need to be called directly.
 *
 * @since 4.6.0
 * @since 5.4.0 The error type is now classified as E_USER_DEPRECATED (used to default to E_USER_NOTICE).
 * @access private
 *
 * @param string $hook        The hook that was used.
 * @param string $version     The version of WordPress that deprecated the hook.
 * @param string $replacement Optional. The hook that should have been used. Default empty string.
 * @param string $message     Optional. A message regarding the change. Default empty.
 */
function _deprecated_hook($hook, $version, $replacement = '', $message = '')
{
    /**
     * Fires when a deprecated hook is called.
     *
     * @since 4.6.0
     *
     * @param string $hook        The hook that was called.
     * @param string $replacement The hook that should be used as a replacement.
     * @param string $version     The version of WordPress that deprecated the argument used.
     * @param string $message     A message regarding the change.
     */
    do_action('deprecated_hook_run', $hook, $replacement, $version, $message);
    /**
     * Filters whether to trigger deprecated hook errors.
     *
     * @since 4.6.0
     *
     * @param bool $trigger Whether to trigger deprecated hook errors. Requires
     *                      `WP_DEBUG` to be defined true.
     */
    if (WP_DEBUG && apply_filters('deprecated_hook_trigger_error', true)) {
        $message = empty($message) ? '' : (' ' . $message);
        if ($replacement) {
            trigger_error(sprintf(
                /* translators: 1: WordPress hook name, 2: Version number, 3: Alternative hook name. */
                __('Hook %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'),
                $hook,
                $version,
                $replacement
            ) . $message, E_USER_DEPRECATED);
        } else {
            trigger_error(sprintf(
                /* translators: 1: WordPress hook name, 2: Version number. */
                __('Hook %1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'),
                $hook,
                $version
            ) . $message, E_USER_DEPRECATED);
        }
    }
}

WordPress Version: 6.1

/**
 * Marks a deprecated action or filter hook as deprecated and throws a notice.
 *
 * Use the {@see 'deprecated_hook_run'} action to get the backtrace describing where
 * the deprecated hook was called.
 *
 * Default behavior is to trigger a user error if `WP_DEBUG` is true.
 *
 * This function is called by the do_action_deprecated() and apply_filters_deprecated()
 * functions, and so generally does not need to be called directly.
 *
 * @since 4.6.0
 * @since 5.4.0 The error type is now classified as E_USER_DEPRECATED (used to default to E_USER_NOTICE).
 * @access private
 *
 * @param string $hook        The hook that was used.
 * @param string $version     The version of WordPress that deprecated the hook.
 * @param string $replacement Optional. The hook that should have been used. Default empty.
 * @param string $message     Optional. A message regarding the change. Default empty.
 */
function _deprecated_hook($hook, $version, $replacement = '', $message = '')
{
    /**
     * Fires when a deprecated hook is called.
     *
     * @since 4.6.0
     *
     * @param string $hook        The hook that was called.
     * @param string $replacement The hook that should be used as a replacement.
     * @param string $version     The version of WordPress that deprecated the argument used.
     * @param string $message     A message regarding the change.
     */
    do_action('deprecated_hook_run', $hook, $replacement, $version, $message);
    /**
     * Filters whether to trigger deprecated hook errors.
     *
     * @since 4.6.0
     *
     * @param bool $trigger Whether to trigger deprecated hook errors. Requires
     *                      `WP_DEBUG` to be defined true.
     */
    if (WP_DEBUG && apply_filters('deprecated_hook_trigger_error', true)) {
        $message = empty($message) ? '' : (' ' . $message);
        if ($replacement) {
            trigger_error(sprintf(
                /* translators: 1: WordPress hook name, 2: Version number, 3: Alternative hook name. */
                __('Hook %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'),
                $hook,
                $version,
                $replacement
            ) . $message, E_USER_DEPRECATED);
        } else {
            trigger_error(sprintf(
                /* translators: 1: WordPress hook name, 2: Version number. */
                __('Hook %1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'),
                $hook,
                $version
            ) . $message, E_USER_DEPRECATED);
        }
    }
}

WordPress Version: 5.5

/**
 * Marks a deprecated action or filter hook as deprecated and throws a notice.
 *
 * Use the {@see 'deprecated_hook_run'} action to get the backtrace describing where
 * the deprecated hook was called.
 *
 * Default behavior is to trigger a user error if `WP_DEBUG` is true.
 *
 * This function is called by the do_action_deprecated() and apply_filters_deprecated()
 * functions, and so generally does not need to be called directly.
 *
 * @since 4.6.0
 * @since 5.4.0 The error type is now classified as E_USER_DEPRECATED (used to default to E_USER_NOTICE).
 * @access private
 *
 * @param string $hook        The hook that was used.
 * @param string $version     The version of WordPress that deprecated the hook.
 * @param string $replacement Optional. The hook that should have been used. Default empty.
 * @param string $message     Optional. A message regarding the change. Default empty.
 */
function _deprecated_hook($hook, $version, $replacement = '', $message = '')
{
    /**
     * Fires when a deprecated hook is called.
     *
     * @since 4.6.0
     *
     * @param string $hook        The hook that was called.
     * @param string $replacement The hook that should be used as a replacement.
     * @param string $version     The version of WordPress that deprecated the argument used.
     * @param string $message     A message regarding the change.
     */
    do_action('deprecated_hook_run', $hook, $replacement, $version, $message);
    /**
     * Filters whether to trigger deprecated hook errors.
     *
     * @since 4.6.0
     *
     * @param bool $trigger Whether to trigger deprecated hook errors. Requires
     *                      `WP_DEBUG` to be defined true.
     */
    if (WP_DEBUG && apply_filters('deprecated_hook_trigger_error', true)) {
        $message = empty($message) ? '' : (' ' . $message);
        if ($replacement) {
            trigger_error(sprintf(
                /* translators: 1: WordPress hook name, 2: Version number, 3: Alternative hook name. */
                __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'),
                $hook,
                $version,
                $replacement
            ) . $message, E_USER_DEPRECATED);
        } else {
            trigger_error(sprintf(
                /* translators: 1: WordPress hook name, 2: Version number. */
                __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'),
                $hook,
                $version
            ) . $message, E_USER_DEPRECATED);
        }
    }
}

WordPress Version: 5.4

/**
 * Marks a deprecated action or filter hook as deprecated and throws a notice.
 *
 * Use the {@see 'deprecated_hook_run'} action to get the backtrace describing where
 * the deprecated hook was called.
 *
 * Default behavior is to trigger a user error if `WP_DEBUG` is true.
 *
 * This function is called by the do_action_deprecated() and apply_filters_deprecated()
 * functions, and so generally does not need to be called directly.
 *
 * @since 4.6.0
 * @since 5.4.0 The error type is now classified as E_USER_DEPRECATED (used to default to E_USER_NOTICE).
 * @access private
 *
 * @param string $hook        The hook that was used.
 * @param string $version     The version of WordPress that deprecated the hook.
 * @param string $replacement Optional. The hook that should have been used. Default null.
 * @param string $message     Optional. A message regarding the change. Default null.
 */
function _deprecated_hook($hook, $version, $replacement = null, $message = null)
{
    /**
     * Fires when a deprecated hook is called.
     *
     * @since 4.6.0
     *
     * @param string $hook        The hook that was called.
     * @param string $replacement The hook that should be used as a replacement.
     * @param string $version     The version of WordPress that deprecated the argument used.
     * @param string $message     A message regarding the change.
     */
    do_action('deprecated_hook_run', $hook, $replacement, $version, $message);
    /**
     * Filters whether to trigger deprecated hook errors.
     *
     * @since 4.6.0
     *
     * @param bool $trigger Whether to trigger deprecated hook errors. Requires
     *                      `WP_DEBUG` to be defined true.
     */
    if (WP_DEBUG && apply_filters('deprecated_hook_trigger_error', true)) {
        $message = empty($message) ? '' : (' ' . $message);
        if (!is_null($replacement)) {
            trigger_error(sprintf(
                /* translators: 1: WordPress hook name, 2: Version number, 3: Alternative hook name. */
                __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'),
                $hook,
                $version,
                $replacement
            ) . $message, E_USER_DEPRECATED);
        } else {
            trigger_error(sprintf(
                /* translators: 1: WordPress hook name, 2: Version number. */
                __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'),
                $hook,
                $version
            ) . $message, E_USER_DEPRECATED);
        }
    }
}

WordPress Version: 5.3

/**
 * Marks a deprecated action or filter hook as deprecated and throws a notice.
 *
 * Use the {@see 'deprecated_hook_run'} action to get the backtrace describing where
 * the deprecated hook was called.
 *
 * Default behavior is to trigger a user error if `WP_DEBUG` is true.
 *
 * This function is called by the do_action_deprecated() and apply_filters_deprecated()
 * functions, and so generally does not need to be called directly.
 *
 * @since 4.6.0
 * @access private
 *
 * @param string $hook        The hook that was used.
 * @param string $version     The version of WordPress that deprecated the hook.
 * @param string $replacement Optional. The hook that should have been used.
 * @param string $message     Optional. A message regarding the change.
 */
function _deprecated_hook($hook, $version, $replacement = null, $message = null)
{
    /**
     * Fires when a deprecated hook is called.
     *
     * @since 4.6.0
     *
     * @param string $hook        The hook that was called.
     * @param string $replacement The hook that should be used as a replacement.
     * @param string $version     The version of WordPress that deprecated the argument used.
     * @param string $message     A message regarding the change.
     */
    do_action('deprecated_hook_run', $hook, $replacement, $version, $message);
    /**
     * Filters whether to trigger deprecated hook errors.
     *
     * @since 4.6.0
     *
     * @param bool $trigger Whether to trigger deprecated hook errors. Requires
     *                      `WP_DEBUG` to be defined true.
     */
    if (WP_DEBUG && apply_filters('deprecated_hook_trigger_error', true)) {
        $message = empty($message) ? '' : (' ' . $message);
        if (!is_null($replacement)) {
            /* translators: 1: WordPress hook name, 2: Version number, 3: Alternative hook name. */
            trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $hook, $version, $replacement) . $message);
        } else {
            /* translators: 1: WordPress hook name, 2: Version number. */
            trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $hook, $version) . $message);
        }
    }
}

WordPress Version: 4.7

/**
 * Marks a deprecated action or filter hook as deprecated and throws a notice.
 *
 * Use the {@see 'deprecated_hook_run'} action to get the backtrace describing where
 * the deprecated hook was called.
 *
 * Default behavior is to trigger a user error if `WP_DEBUG` is true.
 *
 * This function is called by the do_action_deprecated() and apply_filters_deprecated()
 * functions, and so generally does not need to be called directly.
 *
 * @since 4.6.0
 * @access private
 *
 * @param string $hook        The hook that was used.
 * @param string $version     The version of WordPress that deprecated the hook.
 * @param string $replacement Optional. The hook that should have been used.
 * @param string $message     Optional. A message regarding the change.
 */
function _deprecated_hook($hook, $version, $replacement = null, $message = null)
{
    /**
     * Fires when a deprecated hook is called.
     *
     * @since 4.6.0
     *
     * @param string $hook        The hook that was called.
     * @param string $replacement The hook that should be used as a replacement.
     * @param string $version     The version of WordPress that deprecated the argument used.
     * @param string $message     A message regarding the change.
     */
    do_action('deprecated_hook_run', $hook, $replacement, $version, $message);
    /**
     * Filters whether to trigger deprecated hook errors.
     *
     * @since 4.6.0
     *
     * @param bool $trigger Whether to trigger deprecated hook errors. Requires
     *                      `WP_DEBUG` to be defined true.
     */
    if (WP_DEBUG && apply_filters('deprecated_hook_trigger_error', true)) {
        $message = empty($message) ? '' : (' ' . $message);
        if (!is_null($replacement)) {
            /* translators: 1: WordPress hook name, 2: version number, 3: alternative hook name */
            trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $hook, $version, $replacement) . $message);
        } else {
            /* translators: 1: WordPress hook name, 2: version number */
            trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $hook, $version) . $message);
        }
    }
}

WordPress Version: 4.6

/**
 * Marks a deprecated action or filter hook as deprecated and throws a notice.
 *
 * Use the {@see 'deprecated_hook_run'} action to get the backtrace describing where
 * the deprecated hook was called.
 *
 * Default behavior is to trigger a user error if `WP_DEBUG` is true.
 *
 * This function is called by the do_action_deprecated() and apply_filters_deprecated()
 * functions, and so generally does not need to be called directly.
 *
 * @since 4.6.0
 * @access private
 *
 * @param string $hook        The hook that was used.
 * @param string $version     The version of WordPress that deprecated the hook.
 * @param string $replacement Optional. The hook that should have been used.
 * @param string $message     Optional. A message regarding the change.
 */
function _deprecated_hook($hook, $version, $replacement = null, $message = null)
{
    /**
     * Fires when a deprecated hook is called.
     *
     * @since 4.6.0
     *
     * @param string $hook        The hook that was called.
     * @param string $replacement The hook that should be used as a replacement.
     * @param string $version     The version of WordPress that deprecated the argument used.
     * @param string $message     A message regarding the change.
     */
    do_action('deprecated_hook_run', $hook, $replacement, $version, $message);
    /**
     * Filters whether to trigger deprecated hook errors.
     *
     * @since 4.6.0
     *
     * @param bool $trigger Whether to trigger deprecated hook errors. Requires
     *                      `WP_DEBUG` to be defined true.
     */
    if (WP_DEBUG && apply_filters('deprecated_hook_trigger_error', true)) {
        $message = empty($message) ? '' : (' ' . $message);
        if (!is_null($replacement)) {
            trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $hook, $version, $replacement) . $message);
        } else {
            trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $hook, $version) . $message);
        }
    }
}