WordPress.org

Support

Support » Plugins and Hacks » Adding media type

Adding media type

  • 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.

Viewing 1 replies (of 1 total)
  • 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');
Viewing 1 replies (of 1 total)
  • The topic ‘Adding media type’ is closed to new replies.
Skip to toolbar