WP_Scripts::set_group()publicWP 2.8.0

Sets handle group.

Method of the class: WP_Scripts{}

No Hooks.

Return

true|false. Not already in the group or a lower group.

Usage

global $wp_scripts;
$wp_scripts->set_group( $handle, $recursion, $group );
$handle(string) (required)
Name of the item. Should be unique.
$recursion(true|false) (required)
Internal flag that calling function was called recursively.
$group(int|false)
Group level: level (int), no groups (false).
Default: false

Notes

Changelog

Since 2.8.0 Introduced.

WP_Scripts::set_group() code WP 6.5.2

public function set_group( $handle, $recursion, $group = false ) {
	if ( isset( $this->registered[ $handle ]->args ) && 1 === $this->registered[ $handle ]->args ) {
		$grp = 1;
	} else {
		$grp = (int) $this->get_data( $handle, 'group' );
	}

	if ( false !== $group && $grp > $group ) {
		$grp = $group;
	}

	return parent::set_group( $handle, $recursion, $grp );
}