WP_Styles::print_inline_style()publicWP 3.3.0

Prints extra CSS styles of a registered stylesheet.

Method of the class: WP_Styles{}

No Hooks.

Return

String|true|false. False if no data exists, inline styles if $display is true, true otherwise.

Usage

global $wp_styles;
$wp_styles->print_inline_style( $handle, $display );
$handle(string) (required)
The style's registered handle.
$display(true|false)
Whether to print the inline style instead of just returning it.
Default: true

Changelog

Since 3.3.0 Introduced.

WP_Styles::print_inline_style() code WP 6.5.4

public function print_inline_style( $handle, $display = true ) {
	$output = $this->get_data( $handle, 'after' );

	if ( empty( $output ) ) {
		return false;
	}

	$output = implode( "\n", $output );

	if ( ! $display ) {
		return $output;
	}

	printf(
		"<style id='%s-inline-css'%s>\n%s\n</style>\n",
		esc_attr( $handle ),
		$this->type_attr,
		$output
	);

	return true;
}