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.


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


$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.


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 ) );