WordPress at a glance

wp_get_custom_css() WP 1.0

Fetch the saved Custom CSS content for rendering.

Is the basis for: wp_custom_css_cb()
Works based on: wp_get_custom_css_post()
✈ 1 time = 0.005268s = very slow | 50000 times = 9.44s = fast PHP 7.1.5, WP 4.9.1
Hooks from function:
Return

String. The Custom CSS Post content.

Usage

wp_get_custom_css( $stylesheet );
$stylesheet(string)
A theme object stylesheet name.
Default: current theme

Code of wp_get_custom_css: wp-includes/theme.php VER 4.9.8

<?php
function wp_get_custom_css( $stylesheet = '' ) {
	$css = '';

	if ( empty( $stylesheet ) ) {
		$stylesheet = get_stylesheet();
	}

	$post = wp_get_custom_css_post( $stylesheet );
	if ( $post ) {
		$css = $post->post_content;
	}

	/**
	 * Filters the Custom CSS Output into the <head>.
	 *
	 * @since 4.7.0
	 *
	 * @param string $css        CSS pulled in from the Custom CSS CPT.
	 * @param string $stylesheet The theme stylesheet name.
	 */
	$css = apply_filters( 'wp_get_custom_css', $css, $stylesheet );

	return $css;
}

Related Functions

From tag: styles (include files)

More from category: Settings (customizer)

No comments
    Hello, !     Log In . Register