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 );
}

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

© 2020 Jakob Helmer - Powered by WordPress - @trails&tribulations