Automattic / Automattic/page-optimize

apply_filters( 'script_loader_tag' ) does not fire

Open
#48 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
35
Forks
12
PR merge metrics
No merged PRs in 30d

Description

In concat-js.php, in `do_items()`, you have this check:
```
if ( is_array( $js_array['handles'] ) && count( $js_array['handles'] ) === 1 ) {
```

This condition never seems to be true, and the filter never fires.

When I am logged in, handles contains four items:
```
array (
0 => 'hoverintent-js',
1 => 'admin-bar',
2 => 'main',
3 => 'wp-embed',
)
```

When I am not logged in, handles contains two items:
```
array (
0 => 'main',
1 => 'wp-embed',
)
```

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue identifies concat-js.php and do_items(); start by tracing how handles is assembled for logged-in and logged-out requests and reproduce the two arrays. Confirm the completed change by verifying that apply_filters('script_loader_tag') fires for the relevant scripts.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
performance
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.