Make WordPress Core

Opened 7 years ago

Last modified 5 years ago

#38481 new enhancement

wp_handle_upload_prefilter not used before deriving attachment title

Reported by: frodeborli's profile frodeborli Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.6.1
Component: Upload Keywords: dev-feedback
Focuses: Cc:

Description

I created a module that modifies upload behavior. I use the wp_handle_upload_prefilter to alter the $_FILES data - specifically the 'name' property of the uploaded file.

This works well for changing the name of the file being stored in the file system, but the title of the attachment post still accesses the $_FILESasync-upload?name? on line 281 of media.php.

To be able to override the title, I had to hook into the 'sanitize_title' filter on line 293 of media.php - and doing that is, in my book, a hack.

This sanitize_title filter should specify a context.

Change History (1)

#1 @antpb
7 years ago

  • Keywords dev-feedback added
  • Type changed from defect (bug) to enhancement
Note: See TracTickets for help on using tickets.