• Hey,

    Heads up–I was able to fix the js console errors I was getting with WP Notification Bar and the latest ACF Pro 5.7.9 by replacing the Select2.min.js plugin to version 4 min script.

    For reference, the error was Uncaught Error: Option 'multiple' is not allowed for Select2 when attached to a <select> element. After upgrading, the errors were resolved.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thanks for this. For anyone else looking to fix this, download the latest release of Select2 here:

    https://github.com/select2/select2/releases/tag/4.0.5

    Then replace wp-notification-bars/admin/js/select2.full.min.js with the new file you downloaded (dist/js/select2.full.min.js).

    Unfortunately, now the select field is way too wide for the sidebar metabox, but at least the JS error isn’t blocking the rest of the JS on the page.

    It’d be great if they could fix this in the plugin instead of us replacing javascript files manually…

    I’m pretty sure the solution here actually breaks the ability to use the notification select, because the api changes from 3.5 to 4.0.

    Other popular plugins that this conflict happens with: WooCommerce, TheEventsCalendar, and anyone else using select2 on an admin screen.

    The only solution is to wait for the developer to update their code to use 4.0, and enqueue it as ‘select2’ (to share) or encapsulate it (bundle with a module loader).

    As for me, I’m deleting the plugin, and writing a custom notification with ACF, which is what I should have done in the first place.

    Same thing was happening to me. I used the following code to prevent it from loading in the admin.

    function my_mtsnb_force_bar_post_types() {
      if( is_admin() ) {
        return array();
      }
      return array( 'post', 'page' );
    }
    add_filter( 'mtsnb_force_bar_post_types', 'my_mtsnb_force_bar_post_types', 10, 3 );
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Bug: Select2 v3 js errors with ACF’ is closed to new replies.