WP_Styles::add_inline_style()publicWP 3.3.0

Adds extra CSS styles to a registered stylesheet.

Method of the class: WP_Styles{}

No Hooks.

Return

true|false. True on success, false on failure.

Usage

global $wp_styles;
$wp_styles->add_inline_style( $handle, $code );
$handle(string) (required)
The style's registered handle.
$code(string) (required)
String containing the CSS styles to be added.

Changelog

Since 3.3.0 Introduced.

WP_Styles::add_inline_style() code WP 6.4.3

public function add_inline_style( $handle, $code ) {
	if ( ! $code ) {
		return false;
	}

	$after = $this->get_data( $handle, 'after' );
	if ( ! $after ) {
		$after = array();
	}

	$after[] = $code;

	return $this->add_data( $handle, 'after', $after );
}