WP_Scripts::do_item( string $handle, int|false $group = false ): bool
- Since
- 2.6.0, 2.8.0
- Source
wp-includes/class-wp-scripts.php:266
Compatibility
- WordPress
- since 2.8.0
- PHP
- 7.4–8.6-dev
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.
Parameters
$handlestring- The script's registered handle.
$groupint|falseoptional- Group level: level (int), no groups (false).
Default false.Default:false
Return value
bool- True on success, false on failure.
Performance profile
How much work a call to WP_Scripts::do_item() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.
- Cost class
- Trivial
- Scaling
- Constant
- Instructions
- 81–169
- Plugin surface
- 2 hooks
- Called by
- 0
Touches nothing outside its own arguments.
No loop in the body: the same number of instructions runs whatever you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 272.
Third-party callbacks on 'script_loader_src', 'script_loader_tag' run inside this call, and their cost is not bounded by anything here.
Nothing in core calls this; the cost is only what you spend yourself.
What it touches
- hookthird-party callbacks
apply_filters()called directly
Further down the call graph this can also reach option, cache, serialize, query and transient. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.
What one call costs · 40 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost WP_Scripts::do_item() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
::do_item() && $group !== 0 && $group !== false && !$obj && !isset($handle) && !isset($value) && ->is_delayed_strategy() | 81–87 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), ->print_extra_script() |
::do_item() && $group !== 0 && $group !== false && !$obj && !isset($handle) && !isset($value) && ->is_delayed_strategy() | 86–92 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), ->get_data(), ->print_extra_script() |
::do_item() && $group !== 0 && $group !== false && !isset($handle) && !isset($value) && ->is_delayed_strategy() && empty($ver) | 94–104 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), ->print_extra_script(), apply_filters(), esc_url_raw() |
::do_item() && $group !== 0 && $group !== false && !isset($handle) && !isset($value) && ->is_delayed_strategy() && empty($ver) | 99–109 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), ->get_data(), ->print_extra_script(), apply_filters(), esc_url_raw() |
::do_item() && $group !== 0 && $group !== false && !$obj && !isset($handle) && !isset($value) && ->is_delayed_strategy() && !->in_default_dir() | 99–108 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), apply_filters(), ->in_default_dir(), ->in_default_dir(), ->print_extra_script() |
::do_item() && $group !== 0 && $group !== false && !$obj && !isset($handle) && !isset($value) && ->is_delayed_strategy() && ->in_default_dir() | 99–107 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), apply_filters(), ->in_default_dir(), _print_scripts(), ->reset(), ->print_extra_script() |
::do_item() && $group !== 0 && $group !== false && !isset($handle) && !isset($value) && ->is_delayed_strategy() && !empty($ver) | 100–110 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), ->print_extra_script(), add_query_arg(), apply_filters(), esc_url_raw() |
::do_item() && $group !== 0 && $group !== false && !$obj && !isset($handle) && !isset($value) && ->is_delayed_strategy() && ->in_default_dir() | 104–112 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), apply_filters(), ->in_default_dir(), _print_scripts(), ->reset(), ->get_data(), ->print_extra_script() |
::do_item() && $group !== 0 && $group !== false && !isset($handle) && !isset($value) && ->is_delayed_strategy() && !empty($ver) | 105–115 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), ->get_data(), ->print_extra_script(), add_query_arg(), apply_filters(), esc_url_raw() |
::do_item() && $group !== 0 && $group !== false && !$obj && !isset($handle) && !isset($value) && ->is_delayed_strategy() && !->in_default_dir() | 106–113 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), apply_filters(), ->in_default_dir(), ->in_default_dir(), ->get_data(), ->print_extra_script() |
::do_item() && $group !== 0 && $group !== false && !$obj && !isset($handle) && !isset($value) && $value | 108–114 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), apply_filters(), ->in_default_dir(), ->is_delayed_strategy(), ->in_default_dir(), ->print_extra_script() |
::do_item() && $group !== 0 && $group !== false && !isset($handle) && !isset($value) && ->is_delayed_strategy() && ->in_default_dir() && empty($ver) | 112–124 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), apply_filters(), ->in_default_dir(), _print_scripts(), ->reset(), ->print_extra_script(), apply_filters(), esc_url_raw() |
28 further outcomes, up to 169 instructions
::do_item() && $group !== 0 && $group !== false && !$obj && !isset($handle) && !isset($value) && $value | 113–117 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), apply_filters(), ->in_default_dir(), ->is_delayed_strategy(), ->in_default_dir(), ->get_data(), ->print_extra_script() |
::do_item() && $group !== 0 && $group !== false && !isset($handle) && !isset($value) && ->is_delayed_strategy() && !->in_default_dir() && empty($ver) | 114–125 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), apply_filters(), ->in_default_dir(), ->in_default_dir(), ->print_extra_script(), apply_filters(), esc_url_raw() |
::do_item() && $group !== 0 && $group !== false && !isset($handle) && !isset($value) && ->is_delayed_strategy() && ->in_default_dir() && empty($ver) | 117–129 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), apply_filters(), ->in_default_dir(), _print_scripts(), ->reset(), ->get_data(), ->print_extra_script(), apply_filters(), esc_url_raw() |
::do_item() && $group !== 0 && $group !== false && !isset($handle) && !isset($value) && ->is_delayed_strategy() && empty($ver) | 118–133 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), ->print_extra_script(), apply_filters(), esc_url_raw(), wp_get_script_tag(), apply_filters() |
::do_item() && $group !== 0 && $group !== false && !isset($handle) && !isset($value) && ->is_delayed_strategy() && ->in_default_dir() && !empty($ver) | 118–130 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), apply_filters(), ->in_default_dir(), _print_scripts(), ->reset(), ->print_extra_script(), add_query_arg(), apply_filters(), esc_url_raw() |
::do_item() && $group !== 0 && $group !== false && !isset($handle) && !isset($value) && ->is_delayed_strategy() && !->in_default_dir() && empty($ver) | 119–130 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), apply_filters(), ->in_default_dir(), ->in_default_dir(), ->get_data(), ->print_extra_script(), apply_filters(), esc_url_raw() |
::do_item() && $group !== 0 && $group !== false && !isset($handle) && !isset($value) && ->is_delayed_strategy() && !->in_default_dir() && !empty($ver) | 120–131 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), apply_filters(), ->in_default_dir(), ->in_default_dir(), ->print_extra_script(), add_query_arg(), apply_filters(), esc_url_raw() |
::do_item() && $group !== 0 && $group !== false && !isset($handle) && !isset($value) && $value && empty($ver) | 121–131 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), apply_filters(), ->in_default_dir(), ->is_delayed_strategy(), ->in_default_dir(), ->print_extra_script(), apply_filters(), esc_url_raw() |
::do_item() && $group !== 0 && $group !== false && !isset($handle) && !isset($value) && ->is_delayed_strategy() && empty($ver) | 123–138 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), ->get_data(), ->print_extra_script(), apply_filters(), esc_url_raw(), wp_get_script_tag(), apply_filters() |
::do_item() && $group !== 0 && $group !== false && !isset($handle) && !isset($value) && ->is_delayed_strategy() && ->in_default_dir() && !empty($ver) | 123–135 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), apply_filters(), ->in_default_dir(), _print_scripts(), ->reset(), ->get_data(), ->print_extra_script(), add_query_arg(), apply_filters(), esc_url_raw() |
::do_item() && $group !== 0 && $group !== false && !isset($handle) && !isset($value) && ->is_delayed_strategy() && !empty($ver) | 124–139 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), ->print_extra_script(), add_query_arg(), apply_filters(), esc_url_raw(), wp_get_script_tag(), apply_filters() |
::do_item() && $group !== 0 && $group !== false && !isset($handle) && !isset($value) && ->is_delayed_strategy() && !->in_default_dir() && !empty($ver) | 125–136 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), apply_filters(), ->in_default_dir(), ->in_default_dir(), ->get_data(), ->print_extra_script(), add_query_arg(), apply_filters(), esc_url_raw() |
::do_item() && $group !== 0 && $group !== false && !isset($handle) && !isset($value) && $value && empty($ver) | 126–134 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), apply_filters(), ->in_default_dir(), ->is_delayed_strategy(), ->in_default_dir(), ->get_data(), ->print_extra_script(), apply_filters(), esc_url_raw() |
::do_item() && $group !== 0 && $group !== false && !isset($handle) && !isset($value) && $value && !empty($ver) | 127–137 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), apply_filters(), ->in_default_dir(), ->is_delayed_strategy(), ->in_default_dir(), ->print_extra_script(), add_query_arg(), apply_filters(), esc_url_raw() |
::do_item() && $group !== 0 && $group !== false && !isset($handle) && !isset($value) && ->is_delayed_strategy() && !empty($ver) | 129–144 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), ->get_data(), ->print_extra_script(), add_query_arg(), apply_filters(), esc_url_raw(), wp_get_script_tag(), apply_filters() |
::do_item() && $group !== 0 && $group !== false && !isset($handle) && !isset($value) && $value && !empty($ver) | 132–140 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), apply_filters(), ->in_default_dir(), ->is_delayed_strategy(), ->in_default_dir(), ->get_data(), ->print_extra_script(), add_query_arg(), apply_filters(), esc_url_raw() |
::do_item() && $group !== 0 && $group !== false && !isset($handle) && !isset($value) && ->is_delayed_strategy() && ->in_default_dir() && empty($ver) | 136–153 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), apply_filters(), ->in_default_dir(), _print_scripts(), ->reset(), ->print_extra_script(), apply_filters(), esc_url_raw(), wp_get_script_tag(), apply_filters() |
::do_item() && $group !== 0 && $group !== false && !isset($handle) && !isset($value) && ->is_delayed_strategy() && !->in_default_dir() && empty($ver) | 138–154 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), apply_filters(), ->in_default_dir(), ->in_default_dir(), ->print_extra_script(), apply_filters(), esc_url_raw(), wp_get_script_tag(), apply_filters() |
::do_item() && $group !== 0 && $group !== false && !isset($handle) && !isset($value) && ->is_delayed_strategy() && ->in_default_dir() && empty($ver) | 141–158 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), apply_filters(), ->in_default_dir(), _print_scripts(), ->reset(), ->get_data(), ->print_extra_script(), apply_filters(), esc_url_raw(), wp_get_script_tag(), apply_filters() |
::do_item() && $group !== 0 && $group !== false && !isset($handle) && !isset($value) && ->is_delayed_strategy() && ->in_default_dir() && !empty($ver) | 142–159 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), apply_filters(), ->in_default_dir(), _print_scripts(), ->reset(), ->print_extra_script(), add_query_arg(), apply_filters(), esc_url_raw(), wp_get_script_tag(), apply_filters() |
::do_item() && $group !== 0 && $group !== false && !isset($handle) && !isset($value) && ->is_delayed_strategy() && !->in_default_dir() && empty($ver) | 143–159 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), apply_filters(), ->in_default_dir(), ->in_default_dir(), ->get_data(), ->print_extra_script(), apply_filters(), esc_url_raw(), wp_get_script_tag(), apply_filters() |
::do_item() && $group !== 0 && $group !== false && !isset($handle) && !isset($value) && ->is_delayed_strategy() && !->in_default_dir() && !empty($ver) | 144–160 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), apply_filters(), ->in_default_dir(), ->in_default_dir(), ->print_extra_script(), add_query_arg(), apply_filters(), esc_url_raw(), wp_get_script_tag(), apply_filters() |
::do_item() && $group !== 0 && $group !== false && !isset($handle) && !isset($value) && $value && empty($ver) | 145–160 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), apply_filters(), ->in_default_dir(), ->is_delayed_strategy(), ->in_default_dir(), ->print_extra_script(), apply_filters(), esc_url_raw(), wp_get_script_tag(), apply_filters() |
::do_item() && $group !== 0 && $group !== false && !isset($handle) && !isset($value) && ->is_delayed_strategy() && ->in_default_dir() && !empty($ver) | 147–164 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), apply_filters(), ->in_default_dir(), _print_scripts(), ->reset(), ->get_data(), ->print_extra_script(), add_query_arg(), apply_filters(), esc_url_raw(), wp_get_script_tag(), apply_filters() |
::do_item() && $group !== 0 && $group !== false && !isset($handle) && !isset($value) && ->is_delayed_strategy() && !->in_default_dir() && !empty($ver) | 149–165 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), apply_filters(), ->in_default_dir(), ->in_default_dir(), ->get_data(), ->print_extra_script(), add_query_arg(), apply_filters(), esc_url_raw(), wp_get_script_tag(), apply_filters() |
::do_item() && $group !== 0 && $group !== false && !isset($handle) && !isset($value) && $value && empty($ver) | 150–163 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), apply_filters(), ->in_default_dir(), ->is_delayed_strategy(), ->in_default_dir(), ->get_data(), ->print_extra_script(), apply_filters(), esc_url_raw(), wp_get_script_tag(), apply_filters() |
::do_item() && $group !== 0 && $group !== false && !isset($handle) && !isset($value) && $value && !empty($ver) | 151–166 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), apply_filters(), ->in_default_dir(), ->is_delayed_strategy(), ->in_default_dir(), ->print_extra_script(), add_query_arg(), apply_filters(), esc_url_raw(), wp_get_script_tag(), apply_filters() |
::do_item() && $group !== 0 && $group !== false && !isset($handle) && !isset($value) && $value && !empty($ver) | 156–169 | ::do_item(), ->get_eligible_loading_strategy(), ->get_data(), ->is_delayed_strategy(), ->get_inline_script_tag(), ->get_inline_script_tag(), ->print_translations(), apply_filters(), ->in_default_dir(), ->is_delayed_strategy(), ->in_default_dir(), ->get_data(), ->print_extra_script(), add_query_arg(), apply_filters(), esc_url_raw(), wp_get_script_tag(), apply_filters() |
This body has more branch combinations than are worth enumerating, so the table covers the outcomes found first rather than every one that exists.
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 272 | 81–169 | 42 | |
| 8.5 | 272 | 81–169 | 42 | |
| 8.4 | 272 | 81–169 | 42 | 9 fewer instructions than PHP 8.3 |
| 8.3 | 281 | 81–175 | 42 | |
| 8.2 | 281 | 81–175 | 42 | |
| 8.1 | 281 | 81–175 | 42 | 6 fewer instructions than PHP 7.4 |
| 7.4 | 287 | 82–177 | 42 |
An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.
Hooks and filters fired · 3
3 hooks fire while WP_Scripts::do_item() runs, in this order:
- apply_filters( script_loader_src )filterline 356 (+90 into the body)
Filters the script loader source.
- apply_filters( script_loader_src )filterline 412 (+146 into the body)
Filters the script loader source.
- apply_filters( script_loader_tag )filterline 441 (+175 into the body)
Filters the HTML script tag of an enqueued script.
Uses · 17
- wp_get_inline_script_tag()Constructs an inline script tag.
- apply_filters()Calls the callback functions that have been added to a filter hook.
- _print_scripts()Prints scripts (internal use only)
- str_starts_with()Polyfill for `str_starts_with()` function added in PHP 8.0.
- add_query_arg()Retrieves a modified URL query string.
- esc_url_raw()Sanitizes a URL for database or redirect usage.
- wp_get_script_tag()Formats `` loader tags.
- WP_Dependencies::do_item()Processes a dependency.
- WP_Scripts::get_eligible_loading_strategy()Gets the best eligible loading strategy for a script.
- WP_Scripts::get_data()
- WP_Scripts::is_delayed_strategy()Checks if the strategy passed is a valid delayed (non-blocking) strategy.
- WP_Scripts::are_all_dependents_in_footer()Checks whether all dependents of a given handle are in the footer.
Show all 17
- WP_Scripts::get_inline_script_tag()Gets tags for inline scripts registered for a specific handle.
- WP_Scripts::print_translations()Prints translations set for a specific handle.
- WP_Scripts::in_default_dir()Whether a handle's source is in a default directory.
- WP_Scripts::reset()Resets class properties.
- WP_Scripts::print_extra_script()Prints extra scripts of a registered script.
Source code
public function do_item( $handle, $group = false ) { if ( ! parent::do_item( $handle ) ) { return false; } if ( 0 === $group && $this->groups[ $handle ] > 0 ) { $this->in_footer[] = $handle; return false; } if ( false === $group && in_array( $handle, $this->in_footer, true ) ) { $this->in_footer = array_diff( $this->in_footer, (array) $handle ); } $obj = $this->registered[ $handle ]; if ( null === $obj->ver ) { $ver = ''; } else { $ver = $obj->ver ? $obj->ver : $this->default_version; } if ( isset( $this->args[ $handle ] ) ) { $ver = $ver ? $ver . '&' . $this->args[ $handle ] : $this->args[ $handle ]; } $src = $obj->src; $strategy = $this->get_eligible_loading_strategy( $handle ); $intended_strategy = (string) $this->get_data( $handle, 'strategy' ); $ie_conditional_prefix = ''; $ie_conditional_suffix = ''; $conditional = isset( $obj->extra['conditional'] ) ? $obj->extra['conditional'] : ''; if ( ! $this->is_delayed_strategy( $intended_strategy ) ) { $intended_strategy = ''; } /* * Move this script to the footer if: * 1. The script is in the header group. * 2. The current output is the header. * 3. The intended strategy is delayed. * 4. The actual strategy is not delayed. * 5. All dependent scripts are in the footer. */ if ( 0 === $group && 0 === $this->groups[ $handle ] && $intended_strategy && ! $this->is_delayed_strategy( $strategy ) && $this->are_all_dependents_in_footer( $handle ) ) { $this->in_footer[] = $handle; return false; } if ( $conditional ) { $ie_conditional_prefix = "<!--[if {$conditional}]>\n"; $ie_conditional_suffix = "<![endif]-->\n"; } $before_script = $this->get_inline_script_tag( $handle, 'before' ); $after_script = $this->get_inline_script_tag( $handle, 'after' ); if ( $before_script || $after_script ) { $inline_script_tag = $ie_conditional_prefix . $before_script . $after_script . $ie_conditional_suffix; } else { $inline_script_tag = ''; } /* * Prevent concatenation of scripts if the text domain is defined * to ensure the dependency order is respected. */ $translations_stop_concat = ! empty( $obj->textdomain ); $translations = $this->print_translations( $handle, false ); if ( $translations ) { $translations = wp_get_inline_script_tag( $translations, array( 'id' => "{$handle}-js-translations" ) ); }Changelog
Introduced in 2.6.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
$group parameter.from the docblockAbout this page
- Parsed data
- Generated from the wordpress-develop 6.7.7 tag, from
src/wp-includes/class-wp-scripts.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.