Advertisement
julien731

Sensei Fix

Aug 17th, 2016
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.97 KB | None | 0 0
  1. add_action( 'admin_enqueue_scripts', 'wpas_remove_sensei_select2_assets' );
  2. /**
  3.  * Fix compatibility issue with Sensei's select2
  4.  *
  5.  * Sensei uses select2, just like Awesome Support. However, instead of loading select2's assets only where it is used
  6.  * by Sensei, they load the assets everywhere, which messes us with our own instances of select2 if the versions of
  7.  * select2 used by Awesome Support and Sensei don't match.
  8.  *
  9.  * This function will de-register Sensei's select2 on Awesome Support's pages.
  10.  *
  11.  * @since 3.3.2
  12.  * @return void
  13.  */
  14. function wpas_remove_sensei_select2_assets() {
  15.     // Only make changes on our pages. Don't want to mess up even more with other stuff
  16.     if ( function_exists( 'wpas_is_plugin_page' ) && ! wpas_is_plugin_page() ) {
  17.         return;
  18.     }
  19.     // Make sure that ACF Pro is installed and active
  20.     if ( ! class_exists( 'Sensei_Main' ) ) {
  21.         return;
  22.     }
  23.     wp_deregister_script( 'sensei-core-select2' );
  24.     wp_deregister_style( 'sensei-core-select2' );
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement