WP_Theme_JSON::replace_slug_in_string()protected staticWP 5.9.0

Transform a slug into a CSS Custom Property.

{} It's a method of the class: WP_Theme_JSON{}

No Hooks.

Return

String. The CSS Custom Property. Something along the lines of --wp--preset--color--black.

Usage

$result = WP_Theme_JSON::replace_slug_in_string( $input, $slug );
$input(string) (required)
String to replace.
$slug(string) (required)
The slug value to use to generate the custom property.

Changelog

Since 5.9.0 Introduced.

Code of WP_Theme_JSON::replace_slug_in_string() WP 6.0

protected static function replace_slug_in_string( $input, $slug ) {
	return strtr( $input, array( '$slug' => $slug ) );
}