LLMS_Assets::get_inline_priority( float $priority, array $inline_assets = array() )

Auto-increment inline asset priority to prevent duplicates.

Description Description

This ensures that inline assets are always enqueued with a unique priority for their requested location.

Top ↑

Parameters Parameters


(float) (Required) Requested enqueue priority.


(array) (Optional) List of existing inline assets for the requested location.

Default value: array()

Top ↑

Return Return


Top ↑

Source Source

File: includes/class-llms-assets.php

	protected function get_inline_priority( $priority, $inline_assets = array() ) {

		$priority = floatval( $priority );

		if ( $inline_assets ) {

			$priorities = wp_list_pluck( $inline_assets, 'priority' );
			while ( in_array( $priority, $priorities, true ) ) {
				$priority = round( $priority + 0.01, 2 );

		return $priority;


Top ↑

Changelog Changelog

Version Description
7.0.0 When increasing priorities, round to the nearest two decimals.
4.4.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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