Opened 7 months ago
Last modified 12 days ago
#57775 reviewing defect (bug)
wp_create_file_in_uploads Called as Action Hook
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.4 | Priority: | normal |
Severity: | trivial | Version: | 2.5 |
Component: | General | Keywords: | has-patch needs-refresh 2nd-opinion |
Focuses: | Cc: |
Description
The wp_create_file_in_uploads hook is labeled as an Action Hook in the docs but is actually called multiple times as a Filter Hook.
As an Action Hook: class-custom-image-header.php
As a Filter Hook: ajax-actions.php, class-custom-image-header.php (and more)
To keep the docs accurate, this do_action
should be switched to an apply_filters
even though, in this case, nothing will be done with the returned value.
Attachments (1)
Change History (5)
#1
@
5 weeks ago
- Focuses docs removed
- Keywords has-patch added
- Milestone changed from Awaiting Review to 6.4
- Owner set to johnbillion
- Status changed from new to reviewing
#2
follow-up:
↓ 3
@
5 weeks ago
- Keywords needs-refresh 2nd-opinion added
Notes:
- This hook is called as a filter five times and an action twice.
- Its developer reference page documents it as an action.
- There are very few plugins that actually hook into this filter/action, although quite a few that call the hook either as an action or a filter (having mostly copied and pasted from core by the looks of things).
- I also think this should be converted to always be a filter. Converting it to always be an action will break existing filters. I'd like a second opinion though.
- The patch needs to be updated to account for both places in core where this is called as an action:
#3
in reply to:
↑ 2
@
5 weeks ago
- Version changed from 6.1.1 to 2.5
Replying to johnbillion:
I also think this should be converted to always be a filter. Converting it to always be an action will break existing filters. I'd like a second opinion though.
That makes sense to me too.
Introduced in [6551] / #5418, setting the version accordingly.
#4
@
12 days ago
If we change the existing action hook to a filter hook as like this https://core.trac.wordpress.org/attachment/ticket/57775/57775.diff , then what's the point of using filter hooks if we don't use the modified $file
variable?
Action Hook switched to Filter Hook.