WordPress.org

Ready to get started?Download WordPress

Forums

Adding media type (2 posts)

  1. splotch
    Member
    Posted 6 years ago #

    I am trying to add a Flash media type through my plugin. I've used the post_mime_types filter to add the "Flash" mime type. This correctly adds the Flash tab/link to the Media Library page. It also shows that there are X media objects of that type. However, when I click on the link, instead of a list of Flash media objects, I get a "No posts found" message.

    Is there another filter, or action that I need to call to get my Flash objects to show up in the Media Library list? Any help, or links anyone can provide will be greatly appreciated.

  2. splotch
    Member
    Posted 6 years ago #

    Finally figured it out. For some reason typing my questions on this forum seems to expedite the process of finding the solution, whether or not someone replies.

    After digging through the code, I realized that I needed to include the full mime type, not just 'flash'.

    Now Flash files show up correctly in the media library. Here's a simplified snippet of the working code.

    function modify_post_mime_types($post_mime_types) {
    	$post_mime_types['application/x-shockwave-flash'] = array(__('Flash', 'swfobj'), __('Manage Flash', 'swfobj'), __ngettext_noop('Flash (%s)', 'Flash (%s)', 'swfobj'));
    	return $post_mime_types;
    }
    add_filter('post_mime_types', 'modify_post_mime_types');

Topic Closed

This topic has been closed to new replies.

About this Topic