wp_get_custom_css()
Fetches the CSS code from the Theme Customizer settings. The CSS will be retrieved as it is: without a <style> pane.
These styles are saved in the Theme Customizer in "Additional CSS" pane.

To display the Custom CSS wrapped in the <style> tag, use wp_get_custom_css() function.
These styles are displayed automatically by the WordPress itself in the HEAD of the theme during the wp_head action.
Uses: wp_get_custom_css_post()
Used By: wp_custom_css_cb()
1 time — 0.005268 sec (very slow) | 50000 times — 9.44 sec (fast) | PHP 7.1.5, WP 4.9.1
Hooks from the function
Return
String
. The Custom CSS Post content.
Usage
wp_get_custom_css( $stylesheet );
- $stylesheet(string)
- Theme directory name. See get_stylesheet().
Default: current theme
Examples
#1 Get the Custom CSS for the theme
Suppose that we have added some custom CSS in the Theme Customizer in "Additional CSS" pane and now we want to display theme somewhere:
echo '<style>'. wp_get_custom_css() .'</style>';
Changelog
Since 4.7.0 | Introduced. |