A WordPress-centric search engine for devs and theme authors



wp_get_custom_css ›

Since4.7.0
Deprecatedn/a
wp_get_custom_css ( $stylesheet = '' )
Parameters:
  • (string) $stylesheet Optional. A theme object stylesheet name. Defaults to the current theme.
    Required: No
    Default: (empty)
Returns:
  • (string) The Custom CSS Post content.
Defined at:
Codex:

Fetch the saved Custom CSS content for rendering.



Source

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;
}