Title: Problem with select2 function
Last modified: October 17, 2018

---

# Problem with select2 function

 *  Resolved [manoskav](https://wordpress.org/support/users/manoskav/)
 * (@manoskav)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/problem-with-select2-function/)
 * I have the following error in my console causing several problems (e.g. drop 
   down menu is not working on hover).
 * Uncaught TypeError: jQuery(…).select2 is not a function
    at HTMLDocument.<anonymous
   > (um-scripts.min.js?ver=dd6fc7c9f966f21a57e2189aa5ab80f9:1) at i (jquery.js?
   ver=1.12.4:2) at Object.fireWith [as resolveWith] (jquery.js?ver=1.12.4:2) at
   Function.ready (jquery.js?ver=1.12.4:2) at HTMLDocument.K (jquery.js?ver=1.12.4:
   2)
 * If i delete the function select2 from the file /wp-content/plugins/ultimate-member/
   assets/js/um-scripts.min.js everything is ok (until the next update…)
 * Any ideas please?

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

 *  [alexitpro](https://wordpress.org/support/users/alexitpro/)
 * (@alexitpro)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/problem-with-select2-function/#post-11171068)
 * Hi!
 * Got same problem on “Shop” page, when installed UM on site with WooCommerce.
 * Seems for some reason UM does not includes JQuery Select2 library.
 * I’ve added this line in my plugin code and it solved the issue:
 * wp_enqueue_script( ‘select2-js’, ‘[https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/js/select2.min.js&#8217](https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/js/select2.min.js&#8217);,
   array(), ‘4.0.6’, true );
    -  This reply was modified 7 years, 2 months ago by [alexitpro](https://wordpress.org/support/users/alexitpro/).
 *  Thread Starter [manoskav](https://wordpress.org/support/users/manoskav/)
 * (@manoskav)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/problem-with-select2-function/#post-11178242)
 * Thank you [@alexitpro](https://wordpress.org/support/users/alexitpro/)
    Can you
   tell me in which file did you add this piece of code?
 *  [alexitpro](https://wordpress.org/support/users/alexitpro/)
 * (@alexitpro)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/problem-with-select2-function/#post-11178999)
 * [@manoskav](https://wordpress.org/support/users/manoskav/) I use my own plugin,
   which is active all time and put code there.
    In general, I guess you can put
   this line of code in your WP active theme’s file functions.php
 *  Thread Starter [manoskav](https://wordpress.org/support/users/manoskav/)
 * (@manoskav)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/problem-with-select2-function/#post-11179728)
 * Thanks a lot! I ‘ll give it a try and let the community know 🙂
 *  [alexitpro](https://wordpress.org/support/users/alexitpro/)
 * (@alexitpro)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/problem-with-select2-function/#post-11179745)
 * [@manoskav](https://wordpress.org/support/users/manoskav/) welcome and please
   comment the result! 😉
 *  Thread Starter [manoskav](https://wordpress.org/support/users/manoskav/)
 * (@manoskav)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/problem-with-select2-function/#post-11182855)
 * Hi all,
 * I pasted that code in my theme’s functions.php, and now everything is ok. No 
   errors in console.
 * HINT: if you use cPanel editor (and maybe other editors), change the ‘ character,
   otherwise you will get a syntax error.
 * [@alexitpro](https://wordpress.org/support/users/alexitpro/) thanks again 🙂
 *  [alexitpro](https://wordpress.org/support/users/alexitpro/)
 * (@alexitpro)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/problem-with-select2-function/#post-11183134)
 * [@manoskav](https://wordpress.org/support/users/manoskav/) thank you for your
   comment. I would recommend use more functional IDE like NetBeans, PHP Storm, 
   Visual Studio Code. These tools will help you if you forgot part of php syntax
   like difference between ‘ ” ` ‘ quote symbols (juniors mainly are confused 🙂)
 *  [borish1](https://wordpress.org/support/users/borish1/)
 * (@borish1)
 * [6 years, 12 months ago](https://wordpress.org/support/topic/problem-with-select2-function/#post-11420913)
 * Had the same problem but I found a solution to it. Basically what UM does is 
   if class_exists(“WooCoommerce”) it dequeues select2 both style and script. There
   is a hook called “um_dequeue_select2_scripts” to remove the select2 that UM adds
   but that works only partially as the case for this to work is actually this one:
 * $dequeue_select2_status = apply_filters(“um_dequeue_select2_scripts”, false);
   
   if(class_exists(“WooCoommerce”) || $dequeue_select2_status)
 * This means that you cannot really force it to be removed if you have woocommerce
   active. What you can do is deregister and dequeue select2 and then re-enqueue
   one for the woocommerce as a solution for now. That will bring both functionality
   and style of the default woo. Also make sure that your “wp_enqueue_scripts” is
   above priority of 100 as theirs is 100.
 * Hope it will help someone.

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

The topic ‘Problem with select2 function’ 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/)

 * 8 replies
 * 3 participants
 * Last reply from: [borish1](https://wordpress.org/support/users/borish1/)
 * Last activity: [6 years, 12 months ago](https://wordpress.org/support/topic/problem-with-select2-function/#post-11420913)
 * Status: resolved