WP_Dependencies::add_data() WordPress Method

This function allows you to add data to a dependency. The first parameter is the handle of the dependency, the second parameter is the key of the data you want to add, and the third parameter is the data itself. The fourth parameter is an optional array of arguments that can be used to override the default behavior.

WP_Dependencies::add_data( string $handle, string $key, mixed $value ) #

Add extra item data.


Description

Adds data to a registered item.


Top ↑

Parameters

$handle

(string)(Required)Name of the item. Should be unique.

$key

(string)(Required)The data key.

$value

(mixed)(Required)The data value.


Top ↑

Return

(bool) True on success, false on failure.


Top ↑

Source

File: wp-includes/class.wp-dependencies.php

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

		return $this->registered[ $handle ]->add_data( $key, $value );
	}

Top ↑

Changelog

Changelog
VersionDescription
2.6.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.