Add Video Support to WordPress Media Gallery

Add Video Support to WordPress Media Gallery (video-id’s won’t disappear when editing in the visual tab of wp-editor).
This filter deletes the ‘post_mime_type’ in the function ‘wp_ajax_query_attachments()’ which is located in wp-admin/includes/ajax-actions.php
Took me hours to find this out …..

add_filter('ajax_query_attachments_args', 'my_wp_ajax_query_attachments', 1);

function my_wp_ajax_query_attachments( $query ) {
if ($query['post_mime_type'])
    unset($query['post_mime_type']);
    return $query;
$query = apply_filters( 'ajax_query_attachments_args', $query );
}

Author: Jakob

Wordpress & bicycle enthusiast

Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *