Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
When ACF and The Events Calendar both register/enqueue the same script (select2), there are conflicts. This should resolve the issue.
<?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