wp_specialchars

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

WordPress Version: 6.1

/**
 * Legacy escaping for HTML blocks.
 *
 * @deprecated 2.8.0 Use esc_html()
 * @see esc_html()
 *
 * @param string       $text          Text to escape.
 * @param string       $quote_style   Unused.
 * @param false|string $charset       Unused.
 * @param false        $double_encode Whether to double encode. Unused.
 * @return string Escaped `$text`.
 */
function wp_specialchars($text, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false)
{
    _deprecated_function(__FUNCTION__, '2.8.0', 'esc_html()');
    if (func_num_args() > 1) {
        // Maintain back-compat for people passing additional arguments.
        return _wp_specialchars($text, $quote_style, $charset, $double_encode);
    } else {
        return esc_html($text);
    }
}

WordPress Version: 5.3

/**
 * Legacy escaping for HTML blocks.
 *
 * @deprecated 2.8.0 Use esc_html()
 * @see esc_html()
 *
 * @param string       $string        String to escape.
 * @param string       $quote_style   Unused.
 * @param false|string $charset       Unused.
 * @param false        $double_encode Whether to double encode. Unused.
 * @return string Escaped `$string`.
 */
function wp_specialchars($string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false)
{
    _deprecated_function(__FUNCTION__, '2.8.0', 'esc_html()');
    if (func_num_args() > 1) {
        // Maintain back-compat for people passing additional arguments.
        return _wp_specialchars($string, $quote_style, $charset, $double_encode);
    } else {
        return esc_html($string);
    }
}

WordPress Version: 4.6

/**
 * Legacy escaping for HTML blocks.
 *
 * @deprecated 2.8.0 Use esc_html()
 * @see esc_html()
 *
 * @param string       $string        String to escape.
 * @param string       $quote_style   Unused.
 * @param false|string $charset       Unused.
 * @param false        $double_encode Whether to double encode. Unused.
 * @return string Escaped `$string`.
 */
function wp_specialchars($string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false)
{
    _deprecated_function(__FUNCTION__, '2.8.0', 'esc_html()');
    if (func_num_args() > 1) {
        // Maintain back-compat for people passing additional arguments.
        $args = func_get_args();
        return call_user_func_array('_wp_specialchars', $args);
    } else {
        return esc_html($string);
    }
}

WordPress Version: 4.5

/**
 * Legacy escaping for HTML blocks.
 *
 * @deprecated 2.8.0 Use esc_html()
 * @see esc_html()
 *
 * @param string       $string        String to escape.
 * @param string       $quote_style   Unused.
 * @param false|string $charset       Unused.
 * @param false        $double_encode Whether to double encode. Unused.
 * @return string Escaped `$string`.
 */
function wp_specialchars($string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false)
{
    _deprecated_function(__FUNCTION__, '2.8', 'esc_html()');
    if (func_num_args() > 1) {
        // Maintain backwards compat for people passing additional args
        $args = func_get_args();
        return call_user_func_array('_wp_specialchars', $args);
    } else {
        return esc_html($string);
    }
}

WordPress Version: 4.4

/**
 * Escaping for HTML blocks.
 *
 * @deprecated 2.8.0 Use esc_html()
 * @see esc_html()
 */
function wp_specialchars($string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false)
{
    _deprecated_function(__FUNCTION__, '2.8', 'esc_html()');
    if (func_num_args() > 1) {
        // Maintain backwards compat for people passing additional args
        $args = func_get_args();
        return call_user_func_array('_wp_specialchars', $args);
    } else {
        return esc_html($string);
    }
}

WordPress Version: 3.7

/**
 * Escaping for HTML blocks.
 *
 * @deprecated 2.8.0
 * @deprecated Use esc_html()
 * @see esc_html()
 */
function wp_specialchars($string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false)
{
    _deprecated_function(__FUNCTION__, '2.8', 'esc_html()');
    if (func_num_args() > 1) {
        // Maintain backwards compat for people passing additional args
        $args = func_get_args();
        return call_user_func_array('_wp_specialchars', $args);
    } else {
        return esc_html($string);
    }
}