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.
Parameters Parameters
- $priority
-
(float) (Required) Requested enqueue priority.
- $inline_assets
-
(array) (Optional) List of existing inline assets for the requested location.
Default value: array()
Return Return
(float)
Source Source
File: includes/class-llms-assets.php
* @return float */ 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;
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
7.0.0 | When increasing priorities, round to the nearest two decimals. |
4.4.0 | Introduced. |