Skip to content

Instantly share code, notes, and snippets.

@c3mdigital
Last active August 29, 2015 14:00
Show Gist options
  • Save c3mdigital/11391867 to your computer and use it in GitHub Desktop.
Save c3mdigital/11391867 to your computer and use it in GitHub Desktop.
Dequeue the media javascript libraries loaded with wp_enqueue_media
/**
* Remove media library javascript files to prevent other plugins from conflicting with yours.
*/
function dequeue_media_conflicts() {
if ( 'your_plugin_hook_name' !== get_current_screen() ) {
return;
}
wp_dequeue_script( 'media-upload' );
wp_enqueue_script( 'media-editor' );
wp_dequeue_script( 'media-audiovideo' );
wp_dequeue_script( 'mce-view' );
wp_dequeue_script( 'image-edit' );
wp_dequeue_script( 'media-editor' );
wp_dequeue_script( 'media-audiovideo' );
}
add_action( 'admin_print_scripts', 'dequeue_media_conflicts', 9999 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment