WordPress / WordPress/plugin-check
False positives flagged about hook names not starting with the theme/plugin prefix
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 362
- Forks
- 126
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 22
Description
I'm getting these errors now for my AI Services plugin, all of which are false positives:
Error: Hook names invoked by a theme/plugin should start with the theme/plugin prefix. Found: "pre_option_{$option}".
Error: Hook names invoked by a theme/plugin should start with the theme/plugin prefix. Found: "pre_option".
Error: Hook names invoked by a theme/plugin should start with the theme/plugin prefix. Found: "ais_load_services_capabilities".
Error: Hook names invoked by a theme/plugin should start with the theme/plugin prefix. Found: "pre_http_request".
Error: Hook names invoked by a theme/plugin should start with the theme/plugin prefix. Found: "http_request_timeout".
Error: Hook names invoked by a theme/plugin should start with the theme/plugin prefix. Found: "http_request_redirection_count".
Error: Hook names invoked by a theme/plugin should start with the theme/plugin prefix. Found: "http_headers_useragent".
Error: Hook names invoked by a theme/plugin should start with the theme/plugin prefix. Found: "http_request_reject_unsafe_urls".
Error: Hook names invoked by a theme/plugin should start with the theme/plugin prefix. Found: "https_ssl_verify".
There are two underlying problems:
ais_load_services_capabilitiesstarts with "ais", which is a plugin-specific prefix. So that shouldn't be flagged?- All other filters are from WordPress Core, and they have to be reused here to have the plugin behave as expected in combination with the WordPress Core logic.
- Concretely, the plugin implements a batch HTTP request API, and for that to work correctly, it needs to manually trigger certain Core filters again.
So I think it's a false positive to flag these. Ideally, we can find a way to improve this check, or alternatively this could be downgraded to a warning, since there can be inaccuracies like the above?
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
No files or tests are identified in the issue. Start by locating the hook-name prefix check that emits these errors and reproduce it with the listed plugin and WordPress Core hooks. Done means the checker no longer falsely flags valid prefixed or reused Core hooks, or applies an agreed warning behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, wordpress
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100