On this page
WP_Style_Engine::store_css_rule( string $store_name, string $css_selector, string[] $css_declarations ): void.
Stores a CSS rule using the provided CSS selector and CSS declarations.
Parameters
$store_namestring Required-
A valid store key.
$css_selectorstring Required-
When a selector is passed, the function will return a full CSS rule
$selector { ...rules }, otherwise a concatenated string of properties and values. $css_declarationsstring[] Required-
An associative array of CSS definitions, e.g., array( "$property" => "$value", "$property" => "$value" ).
Return
void.
Source
File: wp-includes/style-engine/class-wp-style-engine.php. View all references
public static function store_css_rule( $store_name, $css_selector, $css_declarations ) {
if ( empty( $store_name ) || empty( $css_selector ) || empty( $css_declarations ) ) {
return;
}
static::get_store( $store_name )->add_rule( $css_selector )->add_declarations( $css_declarations );
}
Related
Used By
| Used By | Description |
|---|---|
| wp_style_engine_get_styles() wp-includes/style-engine.php | Global public interface method to generate styles from a single style object, e.g., the value of a block’s attributes.style object or the top level styles in theme.json. |
| wp_style_engine_get_stylesheet_from_css_rules() wp-includes/style-engine.php | Returns compiled CSS from a collection of selectors and declarations. |
Changelog
| Version | Description |
|---|---|
| 6.1.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_style_engine/store_css_rule