WP_Theme_JSON::replace_slug_in_string( string $input, string $slug )

Transform a slug into a CSS Custom Property.


Parameters

$input

(string) (Required) String to replace.

$slug

(string) (Required) The slug value to use to generate the custom property.


Top ↑

Return

(string) The CSS Custom Property. Something along the lines of --wp--preset--color--black.


Top ↑

Source

File: wp-includes/class-wp-theme-json.php

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

Top ↑

Changelog

Changelog
Version Description
5.9.0 Introduced.

Top ↑

User Contributed Notes

You must log in before being able to contribute a note or feedback.