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
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.