rest_handle_doing_it_wrong

The timeline below displays how wordpress function rest_handle_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.2

/**
 * Handles _doing_it_wrong errors.
 *
 * @since 5.5.0
 *
 * @param string      $function_name The function that was called.
 * @param string      $message       A message explaining what has been done incorrectly.
 * @param string|null $version       The version of WordPress where the message was added.
 */
function rest_handle_doing_it_wrong($function_name, $message, $version)
{
    if (!WP_DEBUG || headers_sent()) {
        return;
    }
    if ($version) {
        /* translators: Developer debugging message. 1: PHP function name, 2: WordPress version number, 3: Explanatory message. */
        $string = __('%1$s (since %2$s; %3$s)');
        $string = sprintf($string, $function_name, $version, $message);
    } else {
        /* translators: Developer debugging message. 1: PHP function name, 2: Explanatory message. */
        $string = __('%1$s (%2$s)');
        $string = sprintf($string, $function_name, $message);
    }
    header(sprintf('X-WP-DoingItWrong: %s', $string));
}

WordPress Version: 5.5

/**
 * Handles _doing_it_wrong errors.
 *
 * @since 5.5.0
 *
 * @param string      $function The function that was called.
 * @param string      $message  A message explaining what has been done incorrectly.
 * @param string|null $version  The version of WordPress where the message was added.
 */
function rest_handle_doing_it_wrong($function, $message, $version)
{
    if (!WP_DEBUG || headers_sent()) {
        return;
    }
    if ($version) {
        /* translators: Developer debugging message. 1: PHP function name, 2: WordPress version number, 3: Explanatory message. */
        $string = __('%1$s (since %2$s; %3$s)');
        $string = sprintf($string, $function, $version, $message);
    } else {
        /* translators: Developer debugging message. 1: PHP function name, 2: Explanatory message. */
        $string = __('%1$s (%2$s)');
        $string = sprintf($string, $function, $message);
    }
    header(sprintf('X-WP-DoingItWrong: %s', $string));
}