WP_Theme_JSON::replace_slug_in_string()
Transforms a slug into a CSS Custom Property.
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. |
WP_Theme_JSON::replace_slug_in_string() WP Theme JSON::replace slug in string code WP 6.7.1
protected static function replace_slug_in_string( $input, $slug ) { return strtr( $input, array( '$slug' => $slug ) ); }