WP_Script_Modules::get_highest_fetchpriority( string[] $ids ): 'auto'|'low'|'high'

In this article

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

Gets the highest fetch priority for the provided script IDs.

Parameters

$idsstring[]required
Script module IDs.

Return

'auto'|'low'|'high' Highest fetch priority for the provided script module IDs.

Source

private function get_highest_fetchpriority( array $ids ): string {
	static $high_priority_index = null;
	if ( null === $high_priority_index ) {
		$high_priority_index = count( $this->priorities ) - 1;
	}

	$highest_priority_index = 0;
	foreach ( $ids as $id ) {
		if ( isset( $this->registered[ $id ] ) ) {
			$highest_priority_index = (int) max(
				$highest_priority_index,
				(int) array_search( $this->registered[ $id ]['fetchpriority'], $this->priorities, true )
			);
			if ( $high_priority_index === $highest_priority_index ) {
				break;
			}
		}
	}

	return $this->priorities[ $highest_priority_index ];
}

Changelog

VersionDescription
6.9.0Introduced.

User Contributed Notes

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