WP_Styles::add_datapublicWP 6.9.0

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

Метод класса: WP_Styles{}

Хуков нет.

Возвращает

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

Использование

global $wp_styles;
$wp_styles->add_data( $handle, $key, $value );
$handle(строка) (обязательный)
Name of the item. Should be unique.
$key(строка) (обязательный)
The data key.
$value(разное) (обязательный)
The data value.

Список изменений

С версии 6.9.0 Введена.

Код WP_Styles::add_data() WP 7.0

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