Home Forums ACF PRO Max items for post object field Reply To: Max items for post object field

  • Using custom JS, stuff that’s not listed in the docs

    1) Enqueue your custom JS script on the acf/input/admin_enqueue_scripts hook

    2) You custom script should depend on the acf script handle acf-input

    3) You initialization code should look something like this

    if (typeof acf != 'undefined') {
      acf.add_action('select2_init', function($input, args, settings, $field) {
        // $input (jQuery) hidden input element
        // args (object) args given to the select2 function
        // settings (object) settings given to the acf.select2 function
        // $field (jQuery) field element
        // you need to check the $field element to make sure your looking at the right field
        // you can use the console to see what's in vars
        // for example

    I found this post on the select2 argument that you probably need to set