Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EnqueuedScriptsScope: possible false negative? #648

Closed
alanef opened this issue Sep 19, 2024 · 2 comments · Fixed by #652
Closed

EnqueuedScriptsScope: possible false negative? #648

alanef opened this issue Sep 19, 2024 · 2 comments · Fixed by #652
Labels
[Team] Performance Issues owned by Performance Team

Comments

@alanef
Copy link
Contributor

alanef commented Sep 19, 2024

EnqueuedScriptsScope: frontend/js/frontend.js#L1
This script is being loaded in all contexts.

seems to examine from front end, but script that is to be applied to all front end is limited by scope but warned
public function enqueue_scripts() { if ( ! is_admin() ) { wp_enqueue_script( 'my-script', plugin_dir_url( __FILE__ ) . 'js/frontend.js', array(), $this->version, true ); } }

@ernilambar ernilambar added the [Team] Performance Issues owned by Performance Team label Sep 19, 2024
@swissspidy
Copy link
Member

Not sure I follow. The check is supposed to warn if you are loading a script on every single frontend page, and in your code snippet that's exactly what you are doing. So what's the issue?

@alanef
Copy link
Contributor Author

alanef commented Sep 20, 2024

OK then it is just the wording that needs clarifucation.

"This script is being loaded in all contexts."

shoud be

"This script is being loaded in all frontend contexts."

alanef added a commit to alanef/plugin-check that referenced this issue Sep 20, 2024
Fixes WordPress#448

Clarifies that script contenxt is check front end only
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Team] Performance Issues owned by Performance Team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants