WordPress.org

Make WordPress Core

Opened 7 months ago

Closed 7 months ago

#39628 closed enhancement (fixed)

add $post arg to display_media_states filter

Reported by: pbiron Owned by: SergeyBiryukov
Milestone: 4.8 Priority: normal
Severity: normal Version: 3.2
Component: Media Keywords: good-first-bug has-patch
Focuses: Cc:

Description

It would be good to pass $post to the display_media_states filter, for several reasons:

  1. so that we don't have to rely on global $post being set appropriately
  2. to mirror the display_post_states filter

I started looking into this filter to get around a bug with the Logo state not being added when appropriate (see Ticket 39627), and it took me a while to realize that I could key off of global $post to know whether Logo should be added to $media_states.

Attachments (1)

39628.diff (671 bytes) - added by chriseverson 7 months ago.

Download all attachments as: .zip

Change History (5)

#1 @swissspidy
7 months ago

  • Keywords needs-patch good-first-bug added
  • Milestone changed from Awaiting Review to Future Release
  • Version changed from trunk to 3.2

@chriseverson
7 months ago

#2 @chriseverson
7 months ago

  • Keywords has-patch added; needs-patch removed

#3 @SergeyBiryukov
7 months ago

  • Milestone changed from Future Release to 4.8

#4 @SergeyBiryukov
7 months ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 39926:

Media: Pass the current attachment object to display_media_states filter, for consistency with display_post_states.

Props pbiron, chriseverson.
Fixes #39628.

Note: See TracTickets for help on using tickets.