WP_URL_Pattern_Prefixer::escape_pattern_stringprivate staticWP 6.8.0

Escapes a string for use in a URL pattern component.

Method of the class: WP_URL_Pattern_Prefixer{}

No Hooks.

Returns

String. String with backslashes added where required.

Usage

$result = WP_URL_Pattern_Prefixer::escape_pattern_string( $str ): string;
$str(string) (required)
String to be escaped.

Notes

Changelog

Since 6.8.0 Introduced.

WP_URL_Pattern_Prefixer::escape_pattern_string() code WP 6.8.1

private static function escape_pattern_string( string $str ): string {
	return addcslashes( $str, '+*?:{}()\\' );
}