Home Forums Bug Reports Select2 in repeater broken after update to 5.5.13 Reply To: Select2 in repeater broken after update to 5.5.13

  • I’m pretty sure that it all comes down to the order in which the scripts are enqueued, and I can’t for the life of me figure out why the script in one plugin is loaded before the script in another plugin. All of the plugins in question use a priority of 10 for admin_enqueue_scripts.

    This is the best I could figure out as a temporary corrective action. Force the ACF version to be enqueued first

    add_action('admin_enqueue_scripts', 'early_enqueue_acf_select2', -999);
    function early_enqueue_acf_select2() {
    	$min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
    	$script = acf_get_dir("assets/inc/select2/3/select2{$min}.js");
    	$style = acf_get_dir("assets/inc/select2/3/select2.css");
    	$version = '3.5.2';
    	wp_enqueue_script('select2', $script, array('jquery'), $version );
    	wp_enqueue_style('select2', $style, '', $version );

    Is it a perfect solution, nope, but it will due for me until Elliot gets this sorted out, or some other issue is found. If anyone has the time to kill and the ability to test this I’d like to know it this causes any issues with either ACF or WC because I have at least one site I know of that’s using both. I’ve done some testing on a dev site and things appear to be working, but I wouldn’t mind having confirmation before I update a live site.