wp_custom_css_cb

The timeline below displays how wordpress function wp_custom_css_cb has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.9

/**
 * Renders the Custom CSS style element.
 *
 * @since 4.7.0
 */
function wp_custom_css_cb()
{
    $styles = wp_get_custom_css();
    if ($styles || is_customize_preview()) {
        $type_attr = current_theme_supports('html5', 'style') ? '' : ' type="text/css"';
        ?>
		<style<?php 
        echo $type_attr;
        ?> id="wp-custom-css">
			<?php 
        // Note that esc_html() cannot be used because `div &gt; span` is not interpreted properly.
        echo strip_tags($styles);
        ?>
		</style>
		<?php 
    }
}

WordPress Version: 5.5

/**
 * Renders the Custom CSS style element.
 *
 * @since 4.7.0
 */
function wp_custom_css_cb()
{
    $styles = wp_get_custom_css();
    if ($styles || is_customize_preview()) {
        $type_attr = current_theme_supports('html5', 'style') ? '' : ' type="text/css"';
        ?>
		<style<?php 
        echo $type_attr;
        ?> id="wp-custom-css">
			<?php 
        echo strip_tags($styles);
        // Note that esc_html() cannot be used because `div &gt; span` is not interpreted properly. 
        ?>
		</style>
		<?php 
    }
}

WordPress Version: 5.3

/**
 * Render the Custom CSS style element.
 *
 * @since 4.7.0
 */
function wp_custom_css_cb()
{
    $styles = wp_get_custom_css();
    if ($styles || is_customize_preview()) {
        $type_attr = current_theme_supports('html5', 'style') ? '' : ' type="text/css"';
        ?>
		<style<?php 
        echo $type_attr;
        ?> id="wp-custom-css">
			<?php 
        echo strip_tags($styles);
        // Note that esc_html() cannot be used because `div &gt; span` is not interpreted properly. 
        ?>
		</style>
		<?php 
    }
}

WordPress Version: 5.1

/**
 * Render the Custom CSS style element.
 *
 * @since 4.7.0
 */
function wp_custom_css_cb()
{
    $styles = wp_get_custom_css();
    if ($styles || is_customize_preview()) {
        ?>
		<style type="text/css" id="wp-custom-css">
			<?php 
        echo strip_tags($styles);
        // Note that esc_html() cannot be used because `div &gt; span` is not interpreted properly. 
        ?>
		</style>
		<?php 
    }
}

WordPress Version: 4.9

/**
 * Render the Custom CSS style element.
 *
 * @since 4.7.0
 */
function wp_custom_css_cb()
{
    $styles = wp_get_custom_css();
    if ($styles || is_customize_preview()) {
        ?>
		<style type="text/css" id="wp-custom-css">
			<?php 
        echo strip_tags($styles);
        // Note that esc_html() cannot be used because `div &gt; span` is not interpreted properly. 
        ?>
		</style>
	<?php 
    }
}

WordPress Version: 4.7

/**
 * Render the Custom CSS style element.
 *
 * @since 4.7.0
 * @access public
 */
function wp_custom_css_cb()
{
    $styles = wp_get_custom_css();
    if ($styles || is_customize_preview()) {
        ?>
		<style type="text/css" id="wp-custom-css">
			<?php 
        echo strip_tags($styles);
        // Note that esc_html() cannot be used because `div &gt; span` is not interpreted properly. 
        ?>
		</style>
	<?php 
    }
}