_deprecated_function

The timeline below displays how wordpress function _deprecated_function 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 function as deprecated and inform when it has been used.
 *
 * There is a {@see 'deprecated_function_run'} hook that will be called that can be used
 * to get the backtrace up to what file and function called the deprecated function.
 *
 * The current behavior is to trigger a user error if `WP_DEBUG` is true.
 *
 * This function is to be used in every function that is deprecated.
 *
 * @since 2.5.0
 * @since 5.4.0 This function is no longer marked as "private".
 * @since 5.4.0 The error type is now classified as E_USER_DEPRECATED (used to default to E_USER_NOTICE).
 *
 * @param string $function_name The function that was called.
 * @param string $version       The version of WordPress that deprecated the function.
 * @param string $replacement   Optional. The function that should have been called. Default empty string.
 */
function _deprecated_function($function_name, $version, $replacement = '')
{
    /**
     * Fires when a deprecated function is called.
     *
     * @since 2.5.0
     *
     * @param string $function_name The function that was called.
     * @param string $replacement   The function that should have been called.
     * @param string $version       The version of WordPress that deprecated the function.
     */
    do_action('deprecated_function_run', $function_name, $replacement, $version);
    /**
     * Filters whether to trigger an error for deprecated functions.
     *
     * @since 2.5.0
     *
     * @param bool $trigger Whether to trigger the error for deprecated functions. Default true.
     */
    if (WP_DEBUG && apply_filters('deprecated_function_trigger_error', true)) {
        if (function_exists('__')) {
            if ($replacement) {
                $message = sprintf(
                    /* translators: 1: PHP function name, 2: Version number, 3: Alternative function name. */
                    __('Function %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'),
                    $function_name,
                    $version,
                    $replacement
                );
            } else {
                $message = sprintf(
                    /* translators: 1: PHP function name, 2: Version number. */
                    __('Function %1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'),
                    $function_name,
                    $version
                );
            }
        } else if ($replacement) {
            $message = sprintf('Function %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $function_name, $version, $replacement);
        } else {
            $message = sprintf('Function %1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $function_name, $version);
        }
        wp_trigger_error('', $message, E_USER_DEPRECATED);
    }
}

WordPress Version: 6.2

/**
 * Marks a function as deprecated and inform when it has been used.
 *
 * There is a hook {@see 'deprecated_function_run'} that will be called that can be used
 * to get the backtrace up to what file and function called the deprecated
 * function.
 *
 * The current behavior is to trigger a user error if `WP_DEBUG` is true.
 *
 * This function is to be used in every function that is deprecated.
 *
 * @since 2.5.0
 * @since 5.4.0 This function is no longer marked as "private".
 * @since 5.4.0 The error type is now classified as E_USER_DEPRECATED (used to default to E_USER_NOTICE).
 *
 * @param string $function_name The function that was called.
 * @param string $version       The version of WordPress that deprecated the function.
 * @param string $replacement   Optional. The function that should have been called. Default empty string.
 */
function _deprecated_function($function_name, $version, $replacement = '')
{
    /**
     * Fires when a deprecated function is called.
     *
     * @since 2.5.0
     *
     * @param string $function_name The function that was called.
     * @param string $replacement   The function that should have been called.
     * @param string $version       The version of WordPress that deprecated the function.
     */
    do_action('deprecated_function_run', $function_name, $replacement, $version);
    /**
     * Filters whether to trigger an error for deprecated functions.
     *
     * @since 2.5.0
     *
     * @param bool $trigger Whether to trigger the error for deprecated functions. Default true.
     */
    if (WP_DEBUG && apply_filters('deprecated_function_trigger_error', true)) {
        if (function_exists('__')) {
            if ($replacement) {
                trigger_error(sprintf(
                    /* translators: 1: PHP function name, 2: Version number, 3: Alternative function name. */
                    __('Function %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'),
                    $function_name,
                    $version,
                    $replacement
                ), E_USER_DEPRECATED);
            } else {
                trigger_error(sprintf(
                    /* translators: 1: PHP function name, 2: Version number. */
                    __('Function %1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'),
                    $function_name,
                    $version
                ), E_USER_DEPRECATED);
            }
        } else if ($replacement) {
            trigger_error(sprintf('Function %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $function_name, $version, $replacement), E_USER_DEPRECATED);
        } else {
            trigger_error(sprintf('Function %1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $function_name, $version), E_USER_DEPRECATED);
        }
    }
}

WordPress Version: 6.1

/**
 * Marks a function as deprecated and inform when it has been used.
 *
 * There is a hook {@see 'deprecated_function_run'} that will be called that can be used
 * to get the backtrace up to what file and function called the deprecated
 * function.
 *
 * The current behavior is to trigger a user error if `WP_DEBUG` is true.
 *
 * This function is to be used in every function that is deprecated.
 *
 * @since 2.5.0
 * @since 5.4.0 This function is no longer marked as "private".
 * @since 5.4.0 The error type is now classified as E_USER_DEPRECATED (used to default to E_USER_NOTICE).
 *
 * @param string $function    The function that was called.
 * @param string $version     The version of WordPress that deprecated the function.
 * @param string $replacement Optional. The function that should have been called. Default empty.
 */
function _deprecated_function($function, $version, $replacement = '')
{
    /**
     * Fires when a deprecated function is called.
     *
     * @since 2.5.0
     *
     * @param string $function    The function that was called.
     * @param string $replacement The function that should have been called.
     * @param string $version     The version of WordPress that deprecated the function.
     */
    do_action('deprecated_function_run', $function, $replacement, $version);
    /**
     * Filters whether to trigger an error for deprecated functions.
     *
     * @since 2.5.0
     *
     * @param bool $trigger Whether to trigger the error for deprecated functions. Default true.
     */
    if (WP_DEBUG && apply_filters('deprecated_function_trigger_error', true)) {
        if (function_exists('__')) {
            if ($replacement) {
                trigger_error(sprintf(
                    /* translators: 1: PHP function name, 2: Version number, 3: Alternative function name. */
                    __('Function %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'),
                    $function,
                    $version,
                    $replacement
                ), E_USER_DEPRECATED);
            } else {
                trigger_error(sprintf(
                    /* translators: 1: PHP function name, 2: Version number. */
                    __('Function %1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'),
                    $function,
                    $version
                ), E_USER_DEPRECATED);
            }
        } else if ($replacement) {
            trigger_error(sprintf('Function %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $function, $version, $replacement), E_USER_DEPRECATED);
        } else {
            trigger_error(sprintf('Function %1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version), E_USER_DEPRECATED);
        }
    }
}

WordPress Version: 5.5

/**
 * Mark a function as deprecated and inform when it has been used.
 *
 * There is a {@see 'hook deprecated_function_run'} that will be called that can be used
 * to get the backtrace up to what file and function called the deprecated
 * function.
 *
 * The current behavior is to trigger a user error if `WP_DEBUG` is true.
 *
 * This function is to be used in every function that is deprecated.
 *
 * @since 2.5.0
 * @since 5.4.0 This function is no longer marked as "private".
 * @since 5.4.0 The error type is now classified as E_USER_DEPRECATED (used to default to E_USER_NOTICE).
 *
 * @param string $function    The function that was called.
 * @param string $version     The version of WordPress that deprecated the function.
 * @param string $replacement Optional. The function that should have been called. Default empty.
 */
function _deprecated_function($function, $version, $replacement = '')
{
    /**
     * Fires when a deprecated function is called.
     *
     * @since 2.5.0
     *
     * @param string $function    The function that was called.
     * @param string $replacement The function that should have been called.
     * @param string $version     The version of WordPress that deprecated the function.
     */
    do_action('deprecated_function_run', $function, $replacement, $version);
    /**
     * Filters whether to trigger an error for deprecated functions.
     *
     * @since 2.5.0
     *
     * @param bool $trigger Whether to trigger the error for deprecated functions. Default true.
     */
    if (WP_DEBUG && apply_filters('deprecated_function_trigger_error', true)) {
        if (function_exists('__')) {
            if ($replacement) {
                trigger_error(sprintf(
                    /* translators: 1: PHP function name, 2: Version number, 3: Alternative function name. */
                    __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'),
                    $function,
                    $version,
                    $replacement
                ), E_USER_DEPRECATED);
            } else {
                trigger_error(sprintf(
                    /* translators: 1: PHP function name, 2: Version number. */
                    __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'),
                    $function,
                    $version
                ), E_USER_DEPRECATED);
            }
        } else if ($replacement) {
            trigger_error(sprintf('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $function, $version, $replacement), E_USER_DEPRECATED);
        } else {
            trigger_error(sprintf('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version), E_USER_DEPRECATED);
        }
    }
}

WordPress Version: 5.4

/**
 * Mark a function as deprecated and inform when it has been used.
 *
 * There is a {@see 'hook deprecated_function_run'} that will be called that can be used
 * to get the backtrace up to what file and function called the deprecated
 * function.
 *
 * The current behavior is to trigger a user error if `WP_DEBUG` is true.
 *
 * This function is to be used in every function that is deprecated.
 *
 * @since 2.5.0
 * @since 5.4.0 This function is no longer marked as "private".
 * @since 5.4.0 The error type is now classified as E_USER_DEPRECATED (used to default to E_USER_NOTICE).
 *
 * @param string $function    The function that was called.
 * @param string $version     The version of WordPress that deprecated the function.
 * @param string $replacement Optional. The function that should have been called. Default null.
 */
function _deprecated_function($function, $version, $replacement = null)
{
    /**
     * Fires when a deprecated function is called.
     *
     * @since 2.5.0
     *
     * @param string $function    The function that was called.
     * @param string $replacement The function that should have been called.
     * @param string $version     The version of WordPress that deprecated the function.
     */
    do_action('deprecated_function_run', $function, $replacement, $version);
    /**
     * Filters whether to trigger an error for deprecated functions.
     *
     * @since 2.5.0
     *
     * @param bool $trigger Whether to trigger the error for deprecated functions. Default true.
     */
    if (WP_DEBUG && apply_filters('deprecated_function_trigger_error', true)) {
        if (function_exists('__')) {
            if (!is_null($replacement)) {
                trigger_error(sprintf(
                    /* translators: 1: PHP function name, 2: Version number, 3: Alternative function name. */
                    __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'),
                    $function,
                    $version,
                    $replacement
                ), E_USER_DEPRECATED);
            } else {
                trigger_error(sprintf(
                    /* translators: 1: PHP function name, 2: Version number. */
                    __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'),
                    $function,
                    $version
                ), E_USER_DEPRECATED);
            }
        } else if (!is_null($replacement)) {
            trigger_error(sprintf('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $function, $version, $replacement), E_USER_DEPRECATED);
        } else {
            trigger_error(sprintf('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version), E_USER_DEPRECATED);
        }
    }
}

WordPress Version: 5.3

/**
 * Mark a function as deprecated and inform when it has been used.
 *
 * There is a {@see 'hook deprecated_function_run'} that will be called that can be used
 * to get the backtrace up to what file and function called the deprecated
 * function.
 *
 * The current behavior is to trigger a user error if `WP_DEBUG` is true.
 *
 * This function is to be used in every function that is deprecated.
 *
 * @since 2.5.0
 * @access private
 *
 * @param string $function    The function that was called.
 * @param string $version     The version of WordPress that deprecated the function.
 * @param string $replacement Optional. The function that should have been called. Default null.
 */
function _deprecated_function($function, $version, $replacement = null)
{
    /**
     * Fires when a deprecated function is called.
     *
     * @since 2.5.0
     *
     * @param string $function    The function that was called.
     * @param string $replacement The function that should have been called.
     * @param string $version     The version of WordPress that deprecated the function.
     */
    do_action('deprecated_function_run', $function, $replacement, $version);
    /**
     * Filters whether to trigger an error for deprecated functions.
     *
     * @since 2.5.0
     *
     * @param bool $trigger Whether to trigger the error for deprecated functions. Default true.
     */
    if (WP_DEBUG && apply_filters('deprecated_function_trigger_error', true)) {
        if (function_exists('__')) {
            if (!is_null($replacement)) {
                /* translators: 1: PHP function name, 2: Version number, 3: Alternative function name. */
                trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement));
            } else {
                /* translators: 1: PHP function name, 2: Version number. */
                trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version));
            }
        } else if (!is_null($replacement)) {
            trigger_error(sprintf('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $function, $version, $replacement));
        } else {
            trigger_error(sprintf('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version));
        }
    }
}

WordPress Version: 4.7

/**
 * Mark a function as deprecated and inform when it has been used.
 *
 * There is a {@see 'hook deprecated_function_run'} that will be called that can be used
 * to get the backtrace up to what file and function called the deprecated
 * function.
 *
 * The current behavior is to trigger a user error if `WP_DEBUG` is true.
 *
 * This function is to be used in every function that is deprecated.
 *
 * @since 2.5.0
 * @access private
 *
 * @param string $function    The function that was called.
 * @param string $version     The version of WordPress that deprecated the function.
 * @param string $replacement Optional. The function that should have been called. Default null.
 */
function _deprecated_function($function, $version, $replacement = null)
{
    /**
     * Fires when a deprecated function is called.
     *
     * @since 2.5.0
     *
     * @param string $function    The function that was called.
     * @param string $replacement The function that should have been called.
     * @param string $version     The version of WordPress that deprecated the function.
     */
    do_action('deprecated_function_run', $function, $replacement, $version);
    /**
     * Filters whether to trigger an error for deprecated functions.
     *
     * @since 2.5.0
     *
     * @param bool $trigger Whether to trigger the error for deprecated functions. Default true.
     */
    if (WP_DEBUG && apply_filters('deprecated_function_trigger_error', true)) {
        if (function_exists('__')) {
            if (!is_null($replacement)) {
                /* translators: 1: PHP function name, 2: version number, 3: alternative function name */
                trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement));
            } else {
                /* translators: 1: PHP function name, 2: version number */
                trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version));
            }
        } else if (!is_null($replacement)) {
            trigger_error(sprintf('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $function, $version, $replacement));
        } else {
            trigger_error(sprintf('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version));
        }
    }
}

WordPress Version: 4.6

/**
 * Mark a function as deprecated and inform when it has been used.
 *
 * There is a {@see 'hook deprecated_function_run'} that will be called that can be used
 * to get the backtrace up to what file and function called the deprecated
 * function.
 *
 * The current behavior is to trigger a user error if `WP_DEBUG` is true.
 *
 * This function is to be used in every function that is deprecated.
 *
 * @since 2.5.0
 * @access private
 *
 * @param string $function    The function that was called.
 * @param string $version     The version of WordPress that deprecated the function.
 * @param string $replacement Optional. The function that should have been called. Default null.
 */
function _deprecated_function($function, $version, $replacement = null)
{
    /**
     * Fires when a deprecated function is called.
     *
     * @since 2.5.0
     *
     * @param string $function    The function that was called.
     * @param string $replacement The function that should have been called.
     * @param string $version     The version of WordPress that deprecated the function.
     */
    do_action('deprecated_function_run', $function, $replacement, $version);
    /**
     * Filters whether to trigger an error for deprecated functions.
     *
     * @since 2.5.0
     *
     * @param bool $trigger Whether to trigger the error for deprecated functions. Default true.
     */
    if (WP_DEBUG && apply_filters('deprecated_function_trigger_error', true)) {
        if (function_exists('__')) {
            if (!is_null($replacement)) {
                trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement));
            } else {
                trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version));
            }
        } else if (!is_null($replacement)) {
            trigger_error(sprintf('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $function, $version, $replacement));
        } else {
            trigger_error(sprintf('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version));
        }
    }
}

WordPress Version: 4.0

/**
 * Mark a function as deprecated and inform when it has been used.
 *
 * There is a hook deprecated_function_run that will be called that can be used
 * to get the backtrace up to what file and function called the deprecated
 * function.
 *
 * The current behavior is to trigger a user error if WP_DEBUG is true.
 *
 * This function is to be used in every function that is deprecated.
 *
 * @since 2.5.0
 * @access private
 *
 * @param string $function    The function that was called.
 * @param string $version     The version of WordPress that deprecated the function.
 * @param string $replacement Optional. The function that should have been called. Default null.
 */
function _deprecated_function($function, $version, $replacement = null)
{
    /**
     * Fires when a deprecated function is called.
     *
     * @since 2.5.0
     *
     * @param string $function    The function that was called.
     * @param string $replacement The function that should have been called.
     * @param string $version     The version of WordPress that deprecated the function.
     */
    do_action('deprecated_function_run', $function, $replacement, $version);
    /**
     * Filter whether to trigger an error for deprecated functions.
     *
     * @since 2.5.0
     *
     * @param bool $trigger Whether to trigger the error for deprecated functions. Default true.
     */
    if (WP_DEBUG && apply_filters('deprecated_function_trigger_error', true)) {
        if (function_exists('__')) {
            if (!is_null($replacement)) {
                trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement));
            } else {
                trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version));
            }
        } else if (!is_null($replacement)) {
            trigger_error(sprintf('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $function, $version, $replacement));
        } else {
            trigger_error(sprintf('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version));
        }
    }
}

WordPress Version: 3.9

/**
 * Marks a function as deprecated and informs when it has been used.
 *
 * There is a hook deprecated_function_run that will be called that can be used
 * to get the backtrace up to what file and function called the deprecated
 * function.
 *
 * The current behavior is to trigger a user error if WP_DEBUG is true.
 *
 * This function is to be used in every function that is deprecated.
 *
 * @since 2.5.0
 * @access private
 *
 * @param string $function The function that was called
 * @param string $version The version of WordPress that deprecated the function
 * @param string $replacement Optional. The function that should have been called
 */
function _deprecated_function($function, $version, $replacement = null)
{
    /**
     * Fires when a deprecated function is called.
     *
     * @since 2.5.0
     *
     * @param string $function    The function that was called.
     * @param string $replacement The function that should have been called.
     * @param string $version     The version of WordPress that deprecated the function.
     */
    do_action('deprecated_function_run', $function, $replacement, $version);
    /**
     * Filter whether to trigger an error for deprecated functions.
     *
     * @since 2.5.0
     *
     * @param bool $trigger Whether to trigger the error for deprecated functions. Default true.
     */
    if (WP_DEBUG && apply_filters('deprecated_function_trigger_error', true)) {
        if (function_exists('__')) {
            if (!is_null($replacement)) {
                trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement));
            } else {
                trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version));
            }
        } else if (!is_null($replacement)) {
            trigger_error(sprintf('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $function, $version, $replacement));
        } else {
            trigger_error(sprintf('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version));
        }
    }
}

WordPress Version: 3.7

/**
 * Marks a function as deprecated and informs when it has been used.
 *
 * There is a hook deprecated_function_run that will be called that can be used
 * to get the backtrace up to what file and function called the deprecated
 * function.
 *
 * The current behavior is to trigger a user error if WP_DEBUG is true.
 *
 * This function is to be used in every function that is deprecated.
 *
 * @package WordPress
 * @subpackage Debug
 * @since 2.5.0
 * @access private
 *
 * @uses do_action() Calls 'deprecated_function_run' and passes the function name, what to use instead,
 *   and the version the function was deprecated in.
 * @uses apply_filters() Calls 'deprecated_function_trigger_error' and expects boolean value of true to do
 *   trigger or false to not trigger error.
 *
 * @param string $function The function that was called
 * @param string $version The version of WordPress that deprecated the function
 * @param string $replacement Optional. The function that should have been called
 */
function _deprecated_function($function, $version, $replacement = null)
{
    do_action('deprecated_function_run', $function, $replacement, $version);
    // Allow plugin to filter the output error trigger
    if (WP_DEBUG && apply_filters('deprecated_function_trigger_error', true)) {
        if (function_exists('__')) {
            if (!is_null($replacement)) {
                trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement));
            } else {
                trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version));
            }
        } else if (!is_null($replacement)) {
            trigger_error(sprintf('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $function, $version, $replacement));
        } else {
            trigger_error(sprintf('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version));
        }
    }
}