wp_get_custom_css( string $stylesheet = '' )

Fetch the saved Custom CSS content for rendering.


Description Description


Parameters Parameters

$stylesheet

(string) (Optional) A theme object stylesheet name. Defaults to the current theme.

Default value: ''


Top ↑

Return Return

(string) The Custom CSS Post content.


Top ↑

Source Source

File: wp-includes/theme.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;
}

Top ↑

Changelog Changelog

Changelog
Version Description
4.7.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.