• WordPress automatically prints/enqueues its auto-generated CSS variables in the frontend, and also in the block editor screen.

    I’m using the auto-generated CSS variables for color presets from the theme.json for custom pages in the admin area. But those are not printed/enqueued outside the frontend and the block editor.

    To be more clear, I’m talking about the –wp–preset–color–{$slug} CSS variables defined at body level.

    In the block editor it is enqueued as a <style> tag with id global-styles-css-custom-properties-inline-css and with id global-styles-inline-css for the frontend.

    I would like to print/enqueue them in all the admin area.

    After exploring the codebase for a bit I have tried the following:

    add_action( 'admin_enqueue_scripts', 'wp_enqueue_stored_styles' );

    But that didn’t do anything.

    Is it even possible? What callback should I use for the admin_enqueue_scripts action in order to get those auto-generated CSS variables?

  • You must be logged in to reply to this topic.