Support

Account

Home Forums ACF PRO Limit Taxonomy Multi Select Dropdown Reply To: Limit Taxonomy Multi Select Dropdown

  • Hi @adechriz

    Thanks for the question. This is possible by hooking in and modifying the select2 parameters. ACF contains a JS filter which you can use like so:

    
    <script type="text/javascript">
    (function($) {
    	
    	acf.add_filter('select2_args', function( args, $select, settings ){
    		
    		// limit to 3
    		args.maximumSelectionSize = 3;
    		
    		
    		// return
    		return args;
    		
    	});
    	
    })(jQuery);	
    </script>
    

    This code is untested but should work if you place it on the page with your form. You may need to check the $select (jquery object) and test if it is the correct select field.

    Thanks
    E