WP_Styles::add_data( string $handle, string $key, mixed $value ): bool

In this article

Overrides the add_data method from WP_Dependencies, to allow unsetting dependencies for conditional styles.

Parameters

$handlestringrequired
Name of the item. Should be unique.
$keystringrequired
The data key.
$valuemixedrequired
The data value.

Return

bool True on success, false on failure.

Source

public function add_data( $handle, $key, $value ) {
	if ( ! isset( $this->registered[ $handle ] ) ) {
		return false;
	}

	if ( 'conditional' === $key ) {
		$this->registered[ $handle ]->deps = array();
	}

	return parent::add_data( $handle, $key, $value );
}

Changelog

VersionDescription
6.9.0Introduced.

User Contributed Notes

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