Custom Fields
Re-Envisioned
Support General Maximum amount for multiple select for the "taxonomy advanced"-field

  • Creator
    Topic
  • #30623
    Andreas Wundersee
    Participant

    I use the "taxonomy advanced"-field in a frontend form to select topics for blog entries. People could select multiple categories - so far everything works well - but I need a maximum amount for the selection. I couldn't find the possibility in the documentation for the "taxonomy advanced"-field. Is it possible to limit the number to three?

    Thanks for your support,
    Andi

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #30636
    Long Nguyen
    Moderator

    Hi Andreas,

    You can allow the user to select one category per input box. Then enable the cloneable setting and set the max_clone setting to 3. Here is the sample code:

    [
        'name'           => __( 'Taxonomy', 'your-text-domain' ),
        'id'             => $prefix . 'taxonomy_rbgrdv9a23p',
        'type'           => 'taxonomy_advanced',
        'taxonomy'       => ['category'],
        'field_type'     => 'select_advanced',
        'clone'          => true,
        'max_clone'      => 3,
    ],

    Read more on this documentation https://docs.metabox.io/cloning-fields/

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.