Created
February 27, 2017 15:46
-
-
Save jtsternberg/8d95f6e6f16d5c20fa13eca3e70bbc23 to your computer and use it in GitHub Desktop.
Fix problem with badgeos old select2 version when using gathercontent
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 | |
/** | |
* If badgeos select2 is enqueued, remove it, as it causes conflicts. | |
*/ | |
function fix_badgeos_bug_for_gathercontent( $data ) { | |
// BadgeOS is a bad citizen as it is enqueueing its (old) version of select2 in the entire admin. | |
// It is incompatible with the new version, so we need to remove it on our pages. | |
if ( wp_script_is( 'badgeos-select2', 'enqueued' ) ) { | |
wp_dequeue_script( 'badgeos-select2' ); | |
wp_deregister_script( 'badgeos-select2' ); | |
wp_dequeue_style( 'badgeos-select2-css' ); | |
wp_deregister_style( 'badgeos-select2-css' ); | |
} | |
return $data; | |
} | |
add_filter( 'gathercontent_localized_data', 'fix_badgeos_bug_for_gathercontent' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment