Title: select2 conflicts
Last modified: October 27, 2022

---

# select2 conflicts

 *  [dsimply](https://wordpress.org/support/users/dsimply/)
 * (@dsimply)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/select2-conflicts/)
 * Hope someone can assist, how can I exclude the select2.full.min.js script from
   loading in ultimate members plugin as the theme is using the same script and 
   its causing incompatibility issue with the select dropdown.
 * thanks
    Regards Derek

Viewing 11 replies - 1 through 11 (of 11 total)

 *  [missveronica](https://wordpress.org/support/users/missveronicatv/)
 * (@missveronicatv)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/select2-conflicts/#post-16139350)
 * [@dsimply](https://wordpress.org/support/users/dsimply/)
 * You can exclude your theme’s select2 script by this UM filter hook:
 *     ```
       $dequeue_select2 = apply_filters( 'um_dequeue_select2_scripts', false );
       			if ( class_exists( 'WooCommerce' ) || $dequeue_select2 ) {
       				wp_dequeue_style( 'select2' );
       				wp_deregister_style( 'select2' );
   
       				wp_dequeue_script( 'select2');
       				wp_deregister_script('select2');
       			}
       ```
   
 * Add this code snippet to your active theme’s functions.php file
    or use the “
   Code Snippets” Plugin
 * [https://wordpress.org/plugins/code-snippets/](https://wordpress.org/plugins/code-snippets/)
 * `add_filter( 'um_dequeue_select2_scripts', '__return_true' );`
    -  This reply was modified 3 years, 7 months ago by [missveronica](https://wordpress.org/support/users/missveronicatv/).
    -  This reply was modified 3 years, 7 months ago by [missveronica](https://wordpress.org/support/users/missveronicatv/).
 *  Thread Starter [dsimply](https://wordpress.org/support/users/dsimply/)
 * (@dsimply)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/select2-conflicts/#post-16139864)
 * Thank you for the quick response.
 * I did as you suggested however both scripts are still showing from the theme 
   and UM
 * Here is a screenshot: [https://ibb.co/rc8XwHF](https://ibb.co/rc8XwHF)
 *  [missveronica](https://wordpress.org/support/users/missveronicatv/)
 * (@missveronicatv)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/select2-conflicts/#post-16140005)
 * [@dsimply](https://wordpress.org/support/users/dsimply/)
 * Use only this code snippet and not the bigger one:
 * `add_filter( 'um_dequeue_select2_scripts', '__return_true' );`
 *  [missveronica](https://wordpress.org/support/users/missveronicatv/)
 * (@missveronicatv)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/select2-conflicts/#post-16140060)
 * [@dsimply](https://wordpress.org/support/users/dsimply/)
 * Look at the HTML Source file if you have an id for the theme select2 js file.
   
   The UM id is `select2-js`
 *  [jessepschultz](https://wordpress.org/support/users/jessepschultz/)
 * (@jessepschultz)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/select2-conflicts/#post-16140146)
 * Well that’s weird. If I look at the source code there’s no select2 js files loaded.
   Only css files. Also I noticed the code snippet you sent is checking for WooCommerce
   which I don’t have installed.
 *  [missveronica](https://wordpress.org/support/users/missveronicatv/)
 * (@missveronicatv)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/select2-conflicts/#post-16140170)
 * [@jessepschultz](https://wordpress.org/support/users/jessepschultz/)
 * The code with test for Woocommerce is the UM Core Script where the filter is 
   being used.
    I posted it for better understanding of how the one line code snippet
   changed the logic in UM.
 * You should only add to your functions.php file this code line:
 * `add_filter( 'um_dequeue_select2_scripts', '__return_true' );`
 * Yes CSS files are loaded first but you will find the js files by the end of the
   HTML source.
 *  Thread Starter [dsimply](https://wordpress.org/support/users/dsimply/)
 * (@dsimply)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/select2-conflicts/#post-16140229)
 * Thanks [@missveronicatv](https://wordpress.org/support/users/missveronicatv/)
   
   Below are the two scripts in the source code.
 * So the theme is looks to be: select2.min.js-js
 * `<script type=’text/javascript’ src=’***/wp-content/plugins/ultimate-member/assets/
   js/select2/select2.full.min.js?ver=4.0.13′ id=’select2-js’></script>
 * ‘<script type=’text/javascript’ src=’****/wp-content/themes/freestyle/assets/
   js/modules/plugins/select2.min.js?ver=87f140a253c11ae9c22556b3f3f3b37a’ id=’select2.
   min.js-js’></script>
 *  [missveronica](https://wordpress.org/support/users/missveronicatv/)
 * (@missveronicatv)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/select2-conflicts/#post-16140303)
 * [@dsimply](https://wordpress.org/support/users/dsimply/)
 * Very good info. This explains why the code snippet has no effect.
    Did you have
   the theme js file before or after the UM js file?
 *  Thread Starter [dsimply](https://wordpress.org/support/users/dsimply/)
 * (@dsimply)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/select2-conflicts/#post-16140363)
 * [@missveronicatv](https://wordpress.org/support/users/missveronicatv/) Yes, correct
   the theme js file is being loaded before the UM js file. thanks
 *  [missveronica](https://wordpress.org/support/users/missveronicatv/)
 * (@missveronicatv)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/select2-conflicts/#post-16140412)
 * [@dsimply](https://wordpress.org/support/users/dsimply/)
 * Now you can remove the first code snippet and install this code snippet instead:
 *     ```
       add_filter( 'um_dequeue_select2_scripts', 'um_dequeue_select2_scripts_fix', 10, 1 );
   
       function um_dequeue_select2_scripts_fix( $bool ) {
   
           wp_dequeue_style( 'select2' );
           wp_deregister_style( 'select2' );
   
           wp_dequeue_script( 'select2.min.js');
           wp_deregister_script('select2.min.js');
   
           wp_dequeue_style( 'select2-css' );
           wp_deregister_style( 'select2-css' );
   
           wp_dequeue_script( 'select2.min.js-js');
           wp_deregister_script('select2.min.js-js');
   
           return $bool;
       }
       ```
   
 *  Thread Starter [dsimply](https://wordpress.org/support/users/dsimply/)
 * (@dsimply)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/select2-conflicts/#post-16140463)
 * [@missveronicatv](https://wordpress.org/support/users/missveronicatv/) absolute
   life saver!! Thanks so much for your help. Really appreciate it. Its now working!

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘select2 conflicts’ is closed to new replies.

 * ![](https://ps.w.org/ultimate-member/assets/icon-256x256.png?rev=3160947)
 * [Ultimate Member – User Profile, Registration, Login, Member Directory, Content Restriction & Membership Plugin](https://wordpress.org/plugins/ultimate-member/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ultimate-member/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ultimate-member/)
 * [Active Topics](https://wordpress.org/support/plugin/ultimate-member/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ultimate-member/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ultimate-member/reviews/)

## Tags

 * [select2](https://wordpress.org/support/topic-tag/select2/)

 * 15 replies
 * 3 participants
 * Last reply from: [dsimply](https://wordpress.org/support/users/dsimply/)
 * Last activity: [3 years, 7 months ago](https://wordpress.org/support/topic/select2-conflicts/#post-16140463)
 * Status: not resolved