Created
November 16, 2017 16:29
-
-
Save solepixel/d068dbb1d526034d7df1fa8dced63ec9 to your computer and use it in GitHub Desktop.
When ACF and The Events Calendar both register/enqueue the same script (select2), there are conflicts. This should resolve the issue.
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
<?php | |
/** | |
* Disable Tribe Select2 on non-tribe admin pages | |
*/ | |
function _theme_disable_tribe_select2() { | |
$screen = get_current_screen(); | |
if ( 'tribe_events' === $screen->id ) { | |
return; | |
} | |
$tribe_post_types = array( | |
'tribe_events', | |
'tribe_venue', | |
); | |
if ( in_array( $screen->post_type, $tribe_post_types ) ) { | |
return; | |
} | |
wp_deregister_script( 'tribe-select2' ); | |
} | |
add_action( 'admin_enqueue_scripts', '_theme_disable_tribe_select2', 99 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment