Make WordPress Core

Opened 12 years ago

Closed 11 years ago

#21988 closed enhancement (wontfix)

Filter get_media_item output

Reported by: griffinjt's profile griffinjt Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.4
Component: Media Keywords:
Focuses: Cc:

Description

L1027-1028 of media.php looks like this:

if ( $item = get_media_item( $id, array( 'errors' => isset($errors[$id]) ? $errors[$id] : null) ) )
			$output .= "\n<div id='media-item-$id' class='media-item child-of-$attachment->post_parent preloaded'><div class='progress hidden'><div class='bar'></div></div><div id='media-upload-error-$id' class='hidden'></div><div class='filename hidden'></div>$item\n</div>";

The biggest issue I see with this is that because you can only attach images to one post, this will unnecessarily display images that cannot be attached to the current post type in instances where the Media Library tab is forced to send items even though no editor support has been added for the post type.

In that light, it would be nice to have a filter to remove the output of these unnecessary items in order to improve UI and UX when navigating through images to attach to the post type. Currently I am having to create an error-like overlay on each item that is already attached in order to prevent users from trying to attach an item that is already attached elsewhere.

Where would it make the most sense to have this filter? At the end of get_media_item?

Change History (2)

#1 @SergeyBiryukov
12 years ago

  • Component changed from General to Media
  • Version changed from trunk to 3.4

#2 @ocean90
11 years ago

  • Keywords dev-feedback removed
  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Hello griffinjt, sorry you never got a response.

get_media_item() is one of the functions which aren't used by core anymore, because of the Media overhaul in WordPress 3.5. Adding a filter here won't be much useful.

Note: See TracTickets for help on using tickets.