Last active
August 29, 2015 14:00
-
-
Save c3mdigital/11391867 to your computer and use it in GitHub Desktop.
Dequeue the media javascript libraries loaded with wp_enqueue_media
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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