Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#23843 closed enhancement (fixed)

Consolidate and filter get_attached_audio|video|images

Reported by: helen Owned by: helen
Milestone: 3.6 Priority: normal
Severity: normal Version:
Component: Media Keywords: has-patch commit
Focuses: Cc:


Seeing as they are so very similar, we should probably just de-spaghetti and consolidate them into get_attached_media( $type ). Should also filter the args and the resulting arrays.

Attachments (2)

23843.diff (2.5 KB) - added by helen 8 years ago.
23843.2.diff (2.2 KB) - added by wonderboymusic 8 years ago.

Download all attachments as: .zip

Change History (8)

8 years ago

#1 @helen
8 years ago

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

In 23776:

Add a generic get_attached_media() function and use it in get_attached_audio|video|images. Add filters for the query args and resulting array. fixes #23843.

#2 @nacin
8 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

So my question is, do we even need the wrapper functions? These aren't template tags, so I'm inclined to think, maybe not.

#3 @wonderboymusic
8 years ago

I disdain too much reflection, but I like those API funcs. Also, http://core.trac.wordpress.org/browser/trunk/wp-includes/post.php#L1701

#4 @DrewAPicture
8 years ago

  • Keywords 2nd-opinion added

In the spirit of reducing the absolute weight of functions we're adding in 3.6 (70+ at last count), I'm with @nacin on ditching the wrapper functions.

#5 @wonderboymusic
8 years ago

  • Keywords has-patch commit added; 2nd-opinion removed

Everyone out of the pool 23843.2.diff​

#6 @markjaquith
8 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 24571:

Drop some wrapper functions

  • get_attached_audio() (use get_attached_media( 'audio' ))
  • get_attached_images() (use get_attached_media( 'image' ))
  • get_attached_videos() (use get_attached_media( 'video' ))

props wonderboymusic. fixes #23843.

Note: See TracTickets for help on using tickets.