backslashit

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

WordPress Version: 6.2

/**
 * Adds backslashes before letters and before a number at the start of a string.
 *
 * @since 0.71
 *
 * @param string $value Value to which backslashes will be added.
 * @return string String with backslashes inserted.
 */
function backslashit($value)
{
    if (isset($value[0]) && $value[0] >= '0' && $value[0] <= '9') {
        $value = '\\\\' . $value;
    }
    return addcslashes($value, 'A..Za..z');
}

WordPress Version: 3.7

/**
 * Adds backslashes before letters and before a number at the start of a string.
 *
 * @since 0.71
 *
 * @param string $string Value to which backslashes will be added.
 * @return string String with backslashes inserted.
 */
function backslashit($string)
{
    if (isset($string[0]) && $string[0] >= '0' && $string[0] <= '9') {
        $string = '\\\\' . $string;
    }
    return addcslashes($string, 'A..Za..z');
}