WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 6 months ago

#41977 new enhancement

media_handle_upload() un required second parameter

Reported by: Tkama Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 2.5
Component: Media Keywords: close 2nd-opinion
Focuses: Cc:
PR Number:

Description

Why second parameter of media_handle_upload( $file_id, $post_id ) is required?

It's better to define it as 0 and make it optional. In some cases it's more convenient! And we lose nothing if do so...

Change History (1)

#1 @desrosj
6 months ago

  • Component changed from General to Media
  • Keywords close 2nd-opinion added
  • Version changed from 4.8.2 to 2.5

Hi @Tkama,

I don't know that there's any real benefit to making this change. Future function calls would no longer require the parameter, but requiring the parameter also requires the developer to make a conscious decision about where the image should be attached, if at all.

Marking as a close candidate, but also for a 2nd-opinion.

Note: See TracTickets for help on using tickets.