W3cubDocs

/WordPress

backslashit( string $string )

Adds backslashes before letters and before a number at the start of a string.

Description

Parameters

$string

(string) (Required) Value to which backslashes will be added.

Return

(string) String with backslashes inserted.

Source

File: wp-includes/formatting.php

function backslashit( $string ) {
	if ( isset( $string[0] ) && $string[0] >= '0' && $string[0] <= '9' ) {
		$string = '\\\\' . $string;
	}
	return addcslashes( $string, 'A..Za..z' );
}

Changelog

Version Description
0.71 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/backslashit