Title: WP_Script_Modules::get_highest_fetchpriority
Published: February 24, 2026
Last modified: May 20, 2026

---

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

## In this article

 * [Parameters](https://developer.wordpress.org/reference/classes/wp_script_modules/get_highest_fetchpriority/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_script_modules/get_highest_fetchpriority/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_script_modules/get_highest_fetchpriority/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_script_modules/get_highest_fetchpriority/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_script_modules/get_highest_fetchpriority/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_script_modules/get_highest_fetchpriority/?output_format=md#wp--skip-link--target)

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

Gets the highest fetch priority for the provided script IDs.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_script_modules/get_highest_fetchpriority/?output_format=md#parameters)󠁿

 `$ids`string[]required

Script module IDs.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_script_modules/get_highest_fetchpriority/?output_format=md#return)󠁿

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

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_script_modules/get_highest_fetchpriority/?output_format=md#source)󠁿

    ```php
    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 ];
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-script-modules.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/class-wp-script-modules.php#L477)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/class-wp-script-modules.php#L477-L497)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_script_modules/get_highest_fetchpriority/?output_format=md#related)󠁿

| Used by | Description | 
| [WP_Script_Modules::print_script_module()](https://developer.wordpress.org/reference/classes/wp_script_modules/print_script_module/)`wp-includes/class-wp-script-modules.php` |

Prints the enqueued script module using script tags with type=”module” attributes.

  | 
| [WP_Script_Modules::print_script_module_preloads()](https://developer.wordpress.org/reference/classes/wp_script_modules/print_script_module_preloads/)`wp-includes/class-wp-script-modules.php` |

Prints the static dependencies of the enqueued script modules using link tags with rel=”modulepreload” attributes.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_script_modules/get_highest_fetchpriority/?output_format=md#changelog)󠁿

| Version | Description | 
| [6.9.0](https://developer.wordpress.org/reference/since/6.9.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_script_modules%2Fget_highest_fetchpriority%2F)
before being able to contribute a note or feedback.