Home Forums ACF PRO Limit Taxonomy Multi Select Dropdown


Limit Taxonomy Multi Select Dropdown

  • How i can limit Taxonomy Multi Select input?

    I create Field with this setting :
    Field Type* = Taxonomy
    Field Type = Multiple Values – Multi Select
    Load & Save Terms to Post = checked

    I display the form in the front end. i already success to limit multiple values – checkbox, but i have a problem to limit Multi Select Dropdown.

    Can you help me?

  • 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;

    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.


  • Thank You @Elliot Condon

    I’ll do trial and error based on your code and select2.js documentation

    and I’ll submit the working code here..

  • Hey,

    did you get it to work?

    Best regards!

  • hello @RaZz
    yes, it actually works, i just paste that code above and it works like a charm..

  • For anyone looking, select2 has changed maximumSelectionSize to maximumSelectionLength. An updated version of the above:

    (function($) {
    	acf.add_filter('select2_args', function( args, $select, settings ){
    		// limit to 3
    		args.maximumSelectionLength = 3;
    		return args;
  • This is great.

    I would love to see this integrated natively. It is a very powerful enhancement.

    Also added PER FIELD instead of it just applying the limit of 3 to every taxonomy drop down selection. (I guess you can just target by class name)


  • args.maximumSelectionLength = 3 worked for me. Thank you.

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘Limit Taxonomy Multi Select Dropdown’ is closed to new replies.