-
Notifications
You must be signed in to change notification settings - Fork 4.8k
wp_get_global_styles: for custom props, it should return the CSS format not the shortened internal one #49693
Copy link
Copy link
Closed
Labels
Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.jsonAnything related to the broader Global Styles efforts, including Styles Engine and theme.json[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended
Description
Related #45171
Description
The wp_get_global_styles functions returns an internal format for CSS Custom Properties instead of the proper CSS format.
Step-by-step reproduction instructions
- Use a theme that has a
theme.json. - Paste the following under
styles.blocks:
"core/post-terms": {
"typography": { "fontSize": "var(--wp--preset--font-size--small)" },
"color":{ "background": "var:preset|color|secondary" }
}- Use the
wp_get_global_stylesfunctions to retrieve those styles. For example, paste the following infunctions.phpof the theme:
add_action( 'init', function(){
error_log( print_r( wp_get_global_styles( array(), array('block_name'=>'core/post-terms') ), true ) );
} );The result will be:
(
[typography] => Array( [fontSize] => var(--wp--preset--font-size--small) )
[color] => Array( [background] => var:preset|color|secondary )
)when it should have been
(
[typography] => Array( [fontSize] => var(--wp--preset--font-size--small) )
[color] => Array( [background] => var(--wp--preset--color--secondary) )
)Note the color.background value. It should return the value in a valid CSS value, not the shortened internal format.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.jsonAnything related to the broader Global Styles efforts, including Styles Engine and theme.json[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended
Type
Fields
Give feedbackNo fields configured for issues without a type.