Last active
November 8, 2017 15:55
-
-
Save jaygidwitz/771aa713d94126d6f448c5958c076219 to your computer and use it in GitHub Desktop.
deqeue chart.js from imagify and weDevs wp-project-manager
This file contains hidden or 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
function custom_monsterinsights_remove_conflicting_asset_files() { | |
// Get current screen. | |
$screen = get_current_screen(); | |
// Bail if we're not on a MonsterInsights screen. | |
if ( empty( $screen->id ) || strpos( $screen->id, 'monsterinsights' ) === false ) { | |
return; | |
} | |
$styles = array(); | |
$scripts = array(); | |
$styles = array( | |
'imagify-sweetalert-core', // Imagify | |
'imagify-sweetalert', // Imagify | |
); | |
$scripts = array( | |
'imagify-promise-polyfill', // Imagify | |
'imagify-sweetalert', // Imagify | |
'imagify-chart', // Imagify | |
'cpm_chart', // weDevsOfficial/wp-project-manager | |
); | |
if ( ! empty( $styles ) ) { | |
foreach ( $styles as $style ) { | |
wp_dequeue_style( $style ); // Remove CSS file from MI screen | |
wp_deregister_style( $style ); | |
} | |
} | |
if ( ! empty( $scripts ) ) { | |
foreach ( $scripts as $script ) { | |
wp_dequeue_script( $script ); // Remove JS file from MI screen | |
wp_deregister_script( $script ); | |
} | |
} | |
} | |
add_action( 'admin_enqueue_scripts', 'custom_monsterinsights_remove_conflicting_asset_files', 9998 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment