WordPress Custom CSS (from the Customizer panel) is stored in a Custom Post Type in the wp_posts database table. A reference to the Post ID is stored in the current themes “theme_mod” option value.
There’s a nice helper function called wp_get_custom_css_post
to do this lookup and return the Post object:
$custom_css_post = wp_get_custom_css_post(); $custom_css = $custom_css_post ? custom_css_post->post_content : ''; echo $custom_css;