Skip to content

Instantly share code, notes, and snippets.

@solepixel
Created November 16, 2017 16:29
Show Gist options
  • Save solepixel/d068dbb1d526034d7df1fa8dced63ec9 to your computer and use it in GitHub Desktop.
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.
<?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