[wp-trac] [WordPress Trac] #57775: wp_create_file_in_uploads Called as Action Hook

WordPress Trac noreply at wordpress.org
Sat Aug 26 13:57:56 UTC 2023


#57775: wp_create_file_in_uploads Called as Action Hook
-------------------------------------------------+-------------------------
 Reporter:  Howdy_McGee                          |       Owner:
                                                 |  johnbillion
     Type:  defect (bug)                         |      Status:  reviewing
 Priority:  normal                               |   Milestone:  6.4
Component:  General                              |     Version:  6.1.1
 Severity:  trivial                              |  Resolution:
 Keywords:  has-patch needs-refresh 2nd-opinion  |     Focuses:
-------------------------------------------------+-------------------------
Changes (by johnbillion):

 * keywords:  has-patch => has-patch needs-refresh 2nd-opinion


Comment:

 Notes:

 * This hook is called as a filter five times and an action twice.
 *
 [https://developer.wordpress.org/reference/hooks/wp_create_file_in_uploads/
 Its developer reference page] documents it as an action.
 * [https://wpdirectory.net/search/01H8S1S8QATNXC39MCC8DRP5FH 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:
   - https://github.com/WordPress/wordpress-
 develop/blob/f71140438beeae7c251464dbd65946fdab037c84/src/wp-
 admin/includes/class-custom-background.php#L568
   - https://github.com/WordPress/wordpress-
 develop/blob/f71140438beeae7c251464dbd65946fdab037c84/src/wp-
 admin/includes/class-custom-image-header.php#L885

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57775#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list