Select2 js conflict with Advanced Custom Fields

Home Forums Legacy Support Support queries Other issues Select2 js conflict with Advanced Custom Fields

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #59315
    Etrain
    Spectator
    Hello, Using the latest WPLMS and Advanced Custom Fields, select2.min.js is conflicting with Advanced Custom Fields (ACF) post selection type and breaking javascript on our admin edit screen. Here's how to reproduce:
    1. Install WPLMS.
    2. Install ACF Plugin.
    3. Create an ACF Custom Field Group, targeting the Unit or Course post type.
    4. Add a Custom Field using the Post Object type.
    5. Visit the edit post page where both the ACF Field and WPLMS Field editors co-exist. The Javascript on the page is broken.
    I believe this is because ACF also includes the select 2 library. The console error reads:
    Error: No select2/compat/initSelection /wp-content/plugins/vibe-customtypes/metaboxes/js/select2.min.js:1:1449
    #59397
    H.K. Latiyan
    Participant
    I am unable to replicate the issue on my test setup, refer: http://prntscr.com/bv8d7o and http://prntscr.com/bv8du1 Please make sure your theme and plugins are updated to the latest versions.
    #59529
    Etrain
    Spectator
    Ok it seems this is an issue with the Pro version of Advanced Custom Fields (<span style="color: #000000; font-family: 'Open Sans', sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.5px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none; background-color: #f7fcfe;">5.3.10)</span>, as I too was not able to reproduce the conflict with the standard free version. For some reason, it uses a different select2 module for the metaboxes than the standard version. I'll take this to their forums as well to see if there is a solution.
    #59585
    H.K. Latiyan
    Participant
    The issue is wplms uses select2 version 4.0 and other plugins such as ACF may be using select2 3.x versions, so there are two different versions of select 2 which is causing the issue. So ACF pro needs to dequeue their slect2 script, it won't cause any issue to ACF also because select2 4.0 is also backward compatible and hence ACF pro can also use this script.
Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Select2 js conflict with Advanced Custom Fields’ is closed to new replies.