_doing_it_wrong

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

WordPress Version: 6.4

/**
 * Marks something as being incorrectly called.
 *
 * There is a {@see 'doing_it_wrong_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.
 *
 * @since 3.1.0
 * @since 5.4.0 This function is no longer marked as "private".
 *
 * @param string $function_name The function that was called.
 * @param string $message       A message explaining what has been done incorrectly.
 * @param string $version       The version of WordPress where the message was added.
 */
function _doing_it_wrong($function_name, $message, $version)
{
    /**
     * Fires when the given function is being used incorrectly.
     *
     * @since 3.1.0
     *
     * @param string $function_name The function that was called.
     * @param string $message       A message explaining what has been done incorrectly.
     * @param string $version       The version of WordPress where the message was added.
     */
    do_action('doing_it_wrong_run', $function_name, $message, $version);
    /**
     * Filters whether to trigger an error for _doing_it_wrong() calls.
     *
     * @since 3.1.0
     * @since 5.1.0 Added the $function_name, $message and $version parameters.
     *
     * @param bool   $trigger       Whether to trigger the error for _doing_it_wrong() calls. Default true.
     * @param string $function_name The function that was called.
     * @param string $message       A message explaining what has been done incorrectly.
     * @param string $version       The version of WordPress where the message was added.
     */
    if (WP_DEBUG && apply_filters('doing_it_wrong_trigger_error', true, $function_name, $message, $version)) {
        if (function_exists('__')) {
            if ($version) {
                /* translators: %s: Version number. */
                $version = sprintf(__('(This message was added in version %s.)'), $version);
            }
            $message .= ' ' . sprintf(
                /* translators: %s: Documentation URL. */
                __('Please see <a href="%s">Debugging in WordPress</a> for more information.'),
                __('https://wordpress.org/documentation/article/debugging-in-wordpress/')
            );
            $message = sprintf(
                /* translators: Developer debugging message. 1: PHP function name, 2: Explanatory message, 3: WordPress version number. */
                __('Function %1$s was called <strong>incorrectly</strong>. %2$s %3$s'),
                $function_name,
                $message,
                $version
            );
        } else {
            if ($version) {
                $version = sprintf('(This message was added in version %s.)', $version);
            }
            $message .= sprintf(' Please see <a href="%s">Debugging in WordPress</a> for more information.', 'https://wordpress.org/documentation/article/debugging-in-wordpress/');
            $message = sprintf('Function %1$s was called <strong>incorrectly</strong>. %2$s %3$s', $function_name, $message, $version);
        }
        wp_trigger_error('', $message);
    }
}

WordPress Version: 6.2

/**
 * Marks something as being incorrectly called.
 *
 * There is a hook {@see 'doing_it_wrong_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.
 *
 * @since 3.1.0
 * @since 5.4.0 This function is no longer marked as "private".
 *
 * @param string $function_name The function that was called.
 * @param string $message       A message explaining what has been done incorrectly.
 * @param string $version       The version of WordPress where the message was added.
 */
function _doing_it_wrong($function_name, $message, $version)
{
    /**
     * Fires when the given function is being used incorrectly.
     *
     * @since 3.1.0
     *
     * @param string $function_name The function that was called.
     * @param string $message       A message explaining what has been done incorrectly.
     * @param string $version       The version of WordPress where the message was added.
     */
    do_action('doing_it_wrong_run', $function_name, $message, $version);
    /**
     * Filters whether to trigger an error for _doing_it_wrong() calls.
     *
     * @since 3.1.0
     * @since 5.1.0 Added the $function_name, $message and $version parameters.
     *
     * @param bool   $trigger       Whether to trigger the error for _doing_it_wrong() calls. Default true.
     * @param string $function_name The function that was called.
     * @param string $message       A message explaining what has been done incorrectly.
     * @param string $version       The version of WordPress where the message was added.
     */
    if (WP_DEBUG && apply_filters('doing_it_wrong_trigger_error', true, $function_name, $message, $version)) {
        if (function_exists('__')) {
            if ($version) {
                /* translators: %s: Version number. */
                $version = sprintf(__('(This message was added in version %s.)'), $version);
            }
            $message .= ' ' . sprintf(
                /* translators: %s: Documentation URL. */
                __('Please see <a href="%s">Debugging in WordPress</a> for more information.'),
                __('https://wordpress.org/documentation/article/debugging-in-wordpress/')
            );
            trigger_error(sprintf(
                /* translators: Developer debugging message. 1: PHP function name, 2: Explanatory message, 3: WordPress version number. */
                __('Function %1$s was called <strong>incorrectly</strong>. %2$s %3$s'),
                $function_name,
                $message,
                $version
            ), E_USER_NOTICE);
        } else {
            if ($version) {
                $version = sprintf('(This message was added in version %s.)', $version);
            }
            $message .= sprintf(' Please see <a href="%s">Debugging in WordPress</a> for more information.', 'https://wordpress.org/documentation/article/debugging-in-wordpress/');
            trigger_error(sprintf('Function %1$s was called <strong>incorrectly</strong>. %2$s %3$s', $function_name, $message, $version), E_USER_NOTICE);
        }
    }
}

WordPress Version: 6.1

/**
 * Marks something as being incorrectly called.
 *
 * There is a hook {@see 'doing_it_wrong_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.
 *
 * @since 3.1.0
 * @since 5.4.0 This function is no longer marked as "private".
 *
 * @param string $function The function that was called.
 * @param string $message  A message explaining what has been done incorrectly.
 * @param string $version  The version of WordPress where the message was added.
 */
function _doing_it_wrong($function, $message, $version)
{
    /**
     * Fires when the given function is being used incorrectly.
     *
     * @since 3.1.0
     *
     * @param string $function The function that was called.
     * @param string $message  A message explaining what has been done incorrectly.
     * @param string $version  The version of WordPress where the message was added.
     */
    do_action('doing_it_wrong_run', $function, $message, $version);
    /**
     * Filters whether to trigger an error for _doing_it_wrong() calls.
     *
     * @since 3.1.0
     * @since 5.1.0 Added the $function, $message and $version parameters.
     *
     * @param bool   $trigger  Whether to trigger the error for _doing_it_wrong() calls. Default true.
     * @param string $function The function that was called.
     * @param string $message  A message explaining what has been done incorrectly.
     * @param string $version  The version of WordPress where the message was added.
     */
    if (WP_DEBUG && apply_filters('doing_it_wrong_trigger_error', true, $function, $message, $version)) {
        if (function_exists('__')) {
            if ($version) {
                /* translators: %s: Version number. */
                $version = sprintf(__('(This message was added in version %s.)'), $version);
            }
            $message .= ' ' . sprintf(
                /* translators: %s: Documentation URL. */
                __('Please see <a href="%s">Debugging in WordPress</a> for more information.'),
                __('https://wordpress.org/support/article/debugging-in-wordpress/')
            );
            trigger_error(sprintf(
                /* translators: Developer debugging message. 1: PHP function name, 2: Explanatory message, 3: WordPress version number. */
                __('Function %1$s was called <strong>incorrectly</strong>. %2$s %3$s'),
                $function,
                $message,
                $version
            ), E_USER_NOTICE);
        } else {
            if ($version) {
                $version = sprintf('(This message was added in version %s.)', $version);
            }
            $message .= sprintf(' Please see <a href="%s">Debugging in WordPress</a> for more information.', 'https://wordpress.org/support/article/debugging-in-wordpress/');
            trigger_error(sprintf('Function %1$s was called <strong>incorrectly</strong>. %2$s %3$s', $function, $message, $version), E_USER_NOTICE);
        }
    }
}

WordPress Version: 5.5

/**
 * Mark something as being incorrectly called.
 *
 * There is a hook {@see 'doing_it_wrong_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.
 *
 * @since 3.1.0
 * @since 5.4.0 This function is no longer marked as "private".
 *
 * @param string $function The function that was called.
 * @param string $message  A message explaining what has been done incorrectly.
 * @param string $version  The version of WordPress where the message was added.
 */
function _doing_it_wrong($function, $message, $version)
{
    /**
     * Fires when the given function is being used incorrectly.
     *
     * @since 3.1.0
     *
     * @param string $function The function that was called.
     * @param string $message  A message explaining what has been done incorrectly.
     * @param string $version  The version of WordPress where the message was added.
     */
    do_action('doing_it_wrong_run', $function, $message, $version);
    /**
     * Filters whether to trigger an error for _doing_it_wrong() calls.
     *
     * @since 3.1.0
     * @since 5.1.0 Added the $function, $message and $version parameters.
     *
     * @param bool   $trigger  Whether to trigger the error for _doing_it_wrong() calls. Default true.
     * @param string $function The function that was called.
     * @param string $message  A message explaining what has been done incorrectly.
     * @param string $version  The version of WordPress where the message was added.
     */
    if (WP_DEBUG && apply_filters('doing_it_wrong_trigger_error', true, $function, $message, $version)) {
        if (function_exists('__')) {
            if ($version) {
                /* translators: %s: Version number. */
                $version = sprintf(__('(This message was added in version %s.)'), $version);
            }
            $message .= ' ' . sprintf(
                /* translators: %s: Documentation URL. */
                __('Please see <a href="%s">Debugging in WordPress</a> for more information.'),
                __('https://wordpress.org/support/article/debugging-in-wordpress/')
            );
            trigger_error(sprintf(
                /* translators: Developer debugging message. 1: PHP function name, 2: Explanatory message, 3: WordPress version number. */
                __('%1$s was called <strong>incorrectly</strong>. %2$s %3$s'),
                $function,
                $message,
                $version
            ), E_USER_NOTICE);
        } else {
            if ($version) {
                $version = sprintf('(This message was added in version %s.)', $version);
            }
            $message .= sprintf(' Please see <a href="%s">Debugging in WordPress</a> for more information.', 'https://wordpress.org/support/article/debugging-in-wordpress/');
            trigger_error(sprintf('%1$s was called <strong>incorrectly</strong>. %2$s %3$s', $function, $message, $version), E_USER_NOTICE);
        }
    }
}

WordPress Version: 5.4

/**
 * Mark something as being incorrectly called.
 *
 * There is a hook {@see 'doing_it_wrong_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.
 *
 * @since 3.1.0
 * @since 5.4.0 This function is no longer marked as "private".
 *
 * @param string $function The function that was called.
 * @param string $message  A message explaining what has been done incorrectly.
 * @param string $version  The version of WordPress where the message was added.
 */
function _doing_it_wrong($function, $message, $version)
{
    /**
     * Fires when the given function is being used incorrectly.
     *
     * @since 3.1.0
     *
     * @param string $function The function that was called.
     * @param string $message  A message explaining what has been done incorrectly.
     * @param string $version  The version of WordPress where the message was added.
     */
    do_action('doing_it_wrong_run', $function, $message, $version);
    /**
     * Filters whether to trigger an error for _doing_it_wrong() calls.
     *
     * @since 3.1.0
     * @since 5.1.0 Added the $function, $message and $version parameters.
     *
     * @param bool   $trigger  Whether to trigger the error for _doing_it_wrong() calls. Default true.
     * @param string $function The function that was called.
     * @param string $message  A message explaining what has been done incorrectly.
     * @param string $version  The version of WordPress where the message was added.
     */
    if (WP_DEBUG && apply_filters('doing_it_wrong_trigger_error', true, $function, $message, $version)) {
        if (function_exists('__')) {
            if (is_null($version)) {
                $version = '';
            } else {
                /* translators: %s: Version number. */
                $version = sprintf(__('(This message was added in version %s.)'), $version);
            }
            $message .= ' ' . sprintf(
                /* translators: %s: Documentation URL. */
                __('Please see <a href="%s">Debugging in WordPress</a> for more information.'),
                __('https://wordpress.org/support/article/debugging-in-wordpress/')
            );
            trigger_error(sprintf(
                /* translators: Developer debugging message. 1: PHP function name, 2: Explanatory message, 3: Version information message. */
                __('%1$s was called <strong>incorrectly</strong>. %2$s %3$s'),
                $function,
                $message,
                $version
            ), E_USER_NOTICE);
        } else {
            if (is_null($version)) {
                $version = '';
            } else {
                $version = sprintf('(This message was added in version %s.)', $version);
            }
            $message .= sprintf(' Please see <a href="%s">Debugging in WordPress</a> for more information.', 'https://wordpress.org/support/article/debugging-in-wordpress/');
            trigger_error(sprintf('%1$s was called <strong>incorrectly</strong>. %2$s %3$s', $function, $message, $version), E_USER_NOTICE);
        }
    }
}

WordPress Version: 5.3

/**
 * Mark something as being incorrectly called.
 *
 * There is a hook {@see 'doing_it_wrong_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.
 *
 * @since 3.1.0
 * @access private
 *
 * @param string $function The function that was called.
 * @param string $message  A message explaining what has been done incorrectly.
 * @param string $version  The version of WordPress where the message was added.
 */
function _doing_it_wrong($function, $message, $version)
{
    /**
     * Fires when the given function is being used incorrectly.
     *
     * @since 3.1.0
     *
     * @param string $function The function that was called.
     * @param string $message  A message explaining what has been done incorrectly.
     * @param string $version  The version of WordPress where the message was added.
     */
    do_action('doing_it_wrong_run', $function, $message, $version);
    /**
     * Filters whether to trigger an error for _doing_it_wrong() calls.
     *
     * @since 3.1.0
     * @since 5.1.0 Added the $function, $message and $version parameters.
     *
     * @param bool   $trigger  Whether to trigger the error for _doing_it_wrong() calls. Default true.
     * @param string $function The function that was called.
     * @param string $message  A message explaining what has been done incorrectly.
     * @param string $version  The version of WordPress where the message was added.
     */
    if (WP_DEBUG && apply_filters('doing_it_wrong_trigger_error', true, $function, $message, $version)) {
        if (function_exists('__')) {
            if (is_null($version)) {
                $version = '';
            } else {
                /* translators: %s: Version number. */
                $version = sprintf(__('(This message was added in version %s.)'), $version);
            }
            $message .= ' ' . sprintf(
                /* translators: %s: Documentation URL. */
                __('Please see <a href="%s">Debugging in WordPress</a> for more information.'),
                __('https://wordpress.org/support/article/debugging-in-wordpress/')
            );
            /* translators: Developer debugging message. 1: PHP function name, 2: Explanatory message, 3: Version information message. */
            trigger_error(sprintf(__('%1$s was called <strong>incorrectly</strong>. %2$s %3$s'), $function, $message, $version));
        } else {
            if (is_null($version)) {
                $version = '';
            } else {
                $version = sprintf('(This message was added in version %s.)', $version);
            }
            $message .= sprintf(' Please see <a href="%s">Debugging in WordPress</a> for more information.', 'https://wordpress.org/support/article/debugging-in-wordpress/');
            trigger_error(sprintf('%1$s was called <strong>incorrectly</strong>. %2$s %3$s', $function, $message, $version));
        }
    }
}

WordPress Version: 5.1

/**
 * Mark something as being incorrectly called.
 *
 * There is a hook {@see 'doing_it_wrong_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.
 *
 * @since 3.1.0
 * @access private
 *
 * @param string $function The function that was called.
 * @param string $message  A message explaining what has been done incorrectly.
 * @param string $version  The version of WordPress where the message was added.
 */
function _doing_it_wrong($function, $message, $version)
{
    /**
     * Fires when the given function is being used incorrectly.
     *
     * @since 3.1.0
     *
     * @param string $function The function that was called.
     * @param string $message  A message explaining what has been done incorrectly.
     * @param string $version  The version of WordPress where the message was added.
     */
    do_action('doing_it_wrong_run', $function, $message, $version);
    /**
     * Filters whether to trigger an error for _doing_it_wrong() calls.
     *
     * @since 3.1.0
     * @since 5.1.0 Added the $function, $message and $version parameters.
     *
     * @param bool   $trigger  Whether to trigger the error for _doing_it_wrong() calls. Default true.
     * @param string $function The function that was called.
     * @param string $message  A message explaining what has been done incorrectly.
     * @param string $version  The version of WordPress where the message was added.
     */
    if (WP_DEBUG && apply_filters('doing_it_wrong_trigger_error', true, $function, $message, $version)) {
        if (function_exists('__')) {
            if (is_null($version)) {
                $version = '';
            } else {
                /* translators: %s: version number */
                $version = sprintf(__('(This message was added in version %s.)'), $version);
            }
            /* translators: %s: Codex URL */
            $message .= ' ' . sprintf(__('Please see <a href="%s">Debugging in WordPress</a> for more information.'), __('https://codex.wordpress.org/Debugging_in_WordPress'));
            /* translators: Developer debugging message. 1: PHP function name, 2: Explanatory message, 3: Version information message */
            trigger_error(sprintf(__('%1$s was called <strong>incorrectly</strong>. %2$s %3$s'), $function, $message, $version));
        } else {
            if (is_null($version)) {
                $version = '';
            } else {
                $version = sprintf('(This message was added in version %s.)', $version);
            }
            $message .= sprintf(' Please see <a href="%s">Debugging in WordPress</a> for more information.', 'https://codex.wordpress.org/Debugging_in_WordPress');
            trigger_error(sprintf('%1$s was called <strong>incorrectly</strong>. %2$s %3$s', $function, $message, $version));
        }
    }
}

WordPress Version: 4.7

/**
 * Mark something as being incorrectly called.
 *
 * There is a hook {@see 'doing_it_wrong_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.
 *
 * @since 3.1.0
 * @access private
 *
 * @param string $function The function that was called.
 * @param string $message  A message explaining what has been done incorrectly.
 * @param string $version  The version of WordPress where the message was added.
 */
function _doing_it_wrong($function, $message, $version)
{
    /**
     * Fires when the given function is being used incorrectly.
     *
     * @since 3.1.0
     *
     * @param string $function The function that was called.
     * @param string $message  A message explaining what has been done incorrectly.
     * @param string $version  The version of WordPress where the message was added.
     */
    do_action('doing_it_wrong_run', $function, $message, $version);
    /**
     * Filters whether to trigger an error for _doing_it_wrong() calls.
     *
     * @since 3.1.0
     *
     * @param bool $trigger Whether to trigger the error for _doing_it_wrong() calls. Default true.
     */
    if (WP_DEBUG && apply_filters('doing_it_wrong_trigger_error', true)) {
        if (function_exists('__')) {
            if (is_null($version)) {
                $version = '';
            } else {
                /* translators: %s: version number */
                $version = sprintf(__('(This message was added in version %s.)'), $version);
            }
            /* translators: %s: Codex URL */
            $message .= ' ' . sprintf(__('Please see <a href="%s">Debugging in WordPress</a> for more information.'), __('https://codex.wordpress.org/Debugging_in_WordPress'));
            /* translators: Developer debugging message. 1: PHP function name, 2: Explanatory message, 3: Version information message */
            trigger_error(sprintf(__('%1$s was called <strong>incorrectly</strong>. %2$s %3$s'), $function, $message, $version));
        } else {
            if (is_null($version)) {
                $version = '';
            } else {
                $version = sprintf('(This message was added in version %s.)', $version);
            }
            $message .= sprintf(' Please see <a href="%s">Debugging in WordPress</a> for more information.', 'https://codex.wordpress.org/Debugging_in_WordPress');
            trigger_error(sprintf('%1$s was called <strong>incorrectly</strong>. %2$s %3$s', $function, $message, $version));
        }
    }
}

WordPress Version: 4.6

/**
 * Mark something as being incorrectly called.
 *
 * There is a hook {@see 'doing_it_wrong_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.
 *
 * @since 3.1.0
 * @access private
 *
 * @param string $function The function that was called.
 * @param string $message  A message explaining what has been done incorrectly.
 * @param string $version  The version of WordPress where the message was added.
 */
function _doing_it_wrong($function, $message, $version)
{
    /**
     * Fires when the given function is being used incorrectly.
     *
     * @since 3.1.0
     *
     * @param string $function The function that was called.
     * @param string $message  A message explaining what has been done incorrectly.
     * @param string $version  The version of WordPress where the message was added.
     */
    do_action('doing_it_wrong_run', $function, $message, $version);
    /**
     * Filters whether to trigger an error for _doing_it_wrong() calls.
     *
     * @since 3.1.0
     *
     * @param bool $trigger Whether to trigger the error for _doing_it_wrong() calls. Default true.
     */
    if (WP_DEBUG && apply_filters('doing_it_wrong_trigger_error', true)) {
        if (function_exists('__')) {
            $version = is_null($version) ? '' : sprintf(__('(This message was added in version %s.)'), $version);
            /* translators: %s: Codex URL */
            $message .= ' ' . sprintf(__('Please see <a href="%s">Debugging in WordPress</a> for more information.'), __('https://codex.wordpress.org/Debugging_in_WordPress'));
            trigger_error(sprintf(__('%1$s was called <strong>incorrectly</strong>. %2$s %3$s'), $function, $message, $version));
        } else {
            $version = is_null($version) ? '' : sprintf('(This message was added in version %s.)', $version);
            $message .= sprintf(' Please see <a href="%s">Debugging in WordPress</a> for more information.', 'https://codex.wordpress.org/Debugging_in_WordPress');
            trigger_error(sprintf('%1$s was called <strong>incorrectly</strong>. %2$s %3$s', $function, $message, $version));
        }
    }
}

WordPress Version: 4.4

/**
 * Mark something as being incorrectly called.
 *
 * There is a hook doing_it_wrong_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.
 *
 * @since 3.1.0
 * @access private
 *
 * @param string $function The function that was called.
 * @param string $message  A message explaining what has been done incorrectly.
 * @param string $version  The version of WordPress where the message was added.
 */
function _doing_it_wrong($function, $message, $version)
{
    /**
     * Fires when the given function is being used incorrectly.
     *
     * @since 3.1.0
     *
     * @param string $function The function that was called.
     * @param string $message  A message explaining what has been done incorrectly.
     * @param string $version  The version of WordPress where the message was added.
     */
    do_action('doing_it_wrong_run', $function, $message, $version);
    /**
     * Filter whether to trigger an error for _doing_it_wrong() calls.
     *
     * @since 3.1.0
     *
     * @param bool $trigger Whether to trigger the error for _doing_it_wrong() calls. Default true.
     */
    if (WP_DEBUG && apply_filters('doing_it_wrong_trigger_error', true)) {
        if (function_exists('__')) {
            $version = is_null($version) ? '' : sprintf(__('(This message was added in version %s.)'), $version);
            /* translators: %s: Codex URL */
            $message .= ' ' . sprintf(__('Please see <a href="%s">Debugging in WordPress</a> for more information.'), __('https://codex.wordpress.org/Debugging_in_WordPress'));
            trigger_error(sprintf(__('%1$s was called <strong>incorrectly</strong>. %2$s %3$s'), $function, $message, $version));
        } else {
            $version = is_null($version) ? '' : sprintf('(This message was added in version %s.)', $version);
            $message .= sprintf(' Please see <a href="%s">Debugging in WordPress</a> for more information.', 'https://codex.wordpress.org/Debugging_in_WordPress');
            trigger_error(sprintf('%1$s was called <strong>incorrectly</strong>. %2$s %3$s', $function, $message, $version));
        }
    }
}

WordPress Version: 4.2

/**
 * Mark something as being incorrectly called.
 *
 * There is a hook doing_it_wrong_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.
 *
 * @since 3.1.0
 * @access private
 *
 * @param string $function The function that was called.
 * @param string $message  A message explaining what has been done incorrectly.
 * @param string $version  The version of WordPress where the message was added.
 */
function _doing_it_wrong($function, $message, $version)
{
    /**
     * Fires when the given function is being used incorrectly.
     *
     * @since 3.1.0
     *
     * @param string $function The function that was called.
     * @param string $message  A message explaining what has been done incorrectly.
     * @param string $version  The version of WordPress where the message was added.
     */
    do_action('doing_it_wrong_run', $function, $message, $version);
    /**
     * Filter whether to trigger an error for _doing_it_wrong() calls.
     *
     * @since 3.1.0
     *
     * @param bool $trigger Whether to trigger the error for _doing_it_wrong() calls. Default true.
     */
    if (WP_DEBUG && apply_filters('doing_it_wrong_trigger_error', true)) {
        if (function_exists('__')) {
            $version = is_null($version) ? '' : sprintf(__('(This message was added in version %s.)'), $version);
            $message .= ' ' . __('Please see <a href="https://codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress</a> for more information.');
            trigger_error(sprintf(__('%1$s was called <strong>incorrectly</strong>. %2$s %3$s'), $function, $message, $version));
        } else {
            $version = is_null($version) ? '' : sprintf('(This message was added in version %s.)', $version);
            $message .= ' Please see <a href="https://codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress</a> for more information.';
            trigger_error(sprintf('%1$s was called <strong>incorrectly</strong>. %2$s %3$s', $function, $message, $version));
        }
    }
}

WordPress Version: 4.0

/**
 * Mark something as being incorrectly called.
 *
 * There is a hook doing_it_wrong_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.
 *
 * @since 3.1.0
 * @access private
 *
 * @param string $function The function that was called.
 * @param string $message  A message explaining what has been done incorrectly.
 * @param string $version  The version of WordPress where the message was added.
 */
function _doing_it_wrong($function, $message, $version)
{
    /**
     * Fires when the given function is being used incorrectly.
     *
     * @since 3.1.0
     *
     * @param string $function The function that was called.
     * @param string $message  A message explaining what has been done incorrectly.
     * @param string $version  The version of WordPress where the message was added.
     */
    do_action('doing_it_wrong_run', $function, $message, $version);
    /**
     * Filter whether to trigger an error for _doing_it_wrong() calls.
     *
     * @since 3.1.0
     *
     * @param bool $trigger Whether to trigger the error for _doing_it_wrong() calls. Default true.
     */
    if (WP_DEBUG && apply_filters('doing_it_wrong_trigger_error', true)) {
        if (function_exists('__')) {
            $version = is_null($version) ? '' : sprintf(__('(This message was added in version %s.)'), $version);
            $message .= ' ' . __('Please see <a href="http://codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress</a> for more information.');
            trigger_error(sprintf(__('%1$s was called <strong>incorrectly</strong>. %2$s %3$s'), $function, $message, $version));
        } else {
            $version = is_null($version) ? '' : sprintf('(This message was added in version %s.)', $version);
            $message .= ' Please see <a href="http://codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress</a> for more information.';
            trigger_error(sprintf('%1$s was called <strong>incorrectly</strong>. %2$s %3$s', $function, $message, $version));
        }
    }
}

WordPress Version: 3.9

/**
 * Marks something as being incorrectly called.
 *
 * There is a hook doing_it_wrong_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.
 *
 * @since 3.1.0
 * @access private
 *
 * @param string $function The function that was called.
 * @param string $message A message explaining what has been done incorrectly.
 * @param string $version The version of WordPress where the message was added.
 */
function _doing_it_wrong($function, $message, $version)
{
    /**
     * Fires when the given function is being used incorrectly.
     *
     * @since 3.1.0
     *
     * @param string $function The function that was called.
     * @param string $message  A message explaining what has been done incorrectly.
     * @param string $version  The version of WordPress where the message was added.
     */
    do_action('doing_it_wrong_run', $function, $message, $version);
    /**
     * Filter whether to trigger an error for _doing_it_wrong() calls.
     *
     * @since 3.1.0
     *
     * @param bool $trigger Whether to trigger the error for _doing_it_wrong() calls. Default true.
     */
    if (WP_DEBUG && apply_filters('doing_it_wrong_trigger_error', true)) {
        if (function_exists('__')) {
            $version = is_null($version) ? '' : sprintf(__('(This message was added in version %s.)'), $version);
            $message .= ' ' . __('Please see <a href="http://codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress</a> for more information.');
            trigger_error(sprintf(__('%1$s was called <strong>incorrectly</strong>. %2$s %3$s'), $function, $message, $version));
        } else {
            $version = is_null($version) ? '' : sprintf('(This message was added in version %s.)', $version);
            $message .= ' Please see <a href="http://codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress</a> for more information.';
            trigger_error(sprintf('%1$s was called <strong>incorrectly</strong>. %2$s %3$s', $function, $message, $version));
        }
    }
}

WordPress Version: 3.7

/**
 * Marks something as being incorrectly called.
 *
 * There is a hook doing_it_wrong_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.
 *
 * @package WordPress
 * @subpackage Debug
 * @since 3.1.0
 * @access private
 *
 * @uses do_action() Calls 'doing_it_wrong_run' and passes the function arguments.
 * @uses apply_filters() Calls 'doing_it_wrong_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 $message A message explaining what has been done incorrectly.
 * @param string $version The version of WordPress where the message was added.
 */
function _doing_it_wrong($function, $message, $version)
{
    do_action('doing_it_wrong_run', $function, $message, $version);
    // Allow plugin to filter the output error trigger
    if (WP_DEBUG && apply_filters('doing_it_wrong_trigger_error', true)) {
        if (function_exists('__')) {
            $version = is_null($version) ? '' : sprintf(__('(This message was added in version %s.)'), $version);
            $message .= ' ' . __('Please see <a href="http://codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress</a> for more information.');
            trigger_error(sprintf(__('%1$s was called <strong>incorrectly</strong>. %2$s %3$s'), $function, $message, $version));
        } else {
            $version = is_null($version) ? '' : sprintf('(This message was added in version %s.)', $version);
            $message .= ' Please see <a href="http://codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress</a> for more information.';
            trigger_error(sprintf('%1$s was called <strong>incorrectly</strong>. %2$s %3$s', $function, $message, $version));
        }
    }
}