Make WordPress Core

Opened 7 months ago

Last modified 12 days ago

#57775 reviewing defect (bug)

wp_create_file_in_uploads Called as Action Hook

Reported by: howdy_mcgee's profile Howdy_McGee Owned by: johnbillion's profile johnbillion
Milestone: 6.4 Priority: normal
Severity: trivial Version: 2.5
Component: General Keywords: has-patch needs-refresh 2nd-opinion
Focuses: Cc:


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)

57775.diff (669 bytes) - added by Howdy_McGee 7 months ago.
Action Hook switched to Filter Hook.

Download all attachments as: .zip

Change History (5)

7 months ago

Action Hook switched to Filter Hook.

#1 @johnbillion
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: @johnbillion
5 weeks ago

  • Keywords needs-refresh 2nd-opinion added


#3 in reply to: ↑ 2 @SergeyBiryukov
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 @mhshujon
12 days ago

If we change the existing action hook to a filter hook as like this , then what's the point of using filter hooks if we don't use the modified $file variable?

Note: See TracTickets for help on using tickets.