WordPress / WordPress/plugin-check
Runtime checks that simulate frontend request not reliable in AJAX based workflow
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 362
- Forks
- 126
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 22
Description
When running runtime checks like Enqueued_Scripts_Scope_Check or Enqueued_Styles_Scope_Check using the AJAX based flow, they may not detect problems correctly. A crucial issue is that AJAX requests are considered "WP Admin", so functions like is_admin() will return true. It's common for plugins to have a check like ! is_admin() around initialization logic that is specifically for the frontend, which means any such behaviors will not be spotted.
You can verify this by running the "Performance" checks against contact-form-7 for example, which enqueues scripts and stylesheets across the entire site.
The AJAX based flow won't detect that - only the WP-CLI based flow will. The latter is because WP-CLI does not run in "WP Admin context".
I'm not sure there's a way to override what is_admin() returns... But worth thinking through this.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the Performance checks against contact-form-7 through both the AJAX-based and WP-CLI-based flows, focusing on Enqueued_Scripts_Scope_Check and Enqueued_Styles_Scope_Check. Compare the results and trace the runtime-check entry points to determine how frontend behavior is represented; done means the AJAX flow reliably detects the same frontend-only enqueue problems.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100