Custom Fields
Re-Envisioned
Support General select_all_none Not Working Perfectly

  • Creator
    Topic
  • #17961
    Kiran Modak
    Participant

    Hi,

    Here My Code,

    
    array(
        'id' => $prefix . 'name',
        'name' => esc_html__( 'All Names', 'text-domain' ),
        'type' => 'post',
        'multiple' => true,
        'post_type' => array( 'names' ),             
        'select_all_none' => true, 
        'field_type' => 'select'
    ),
    
    Problem is, there are 16 name in names post type. but only 10 will be selected when i click Select All.
    
    Thanks.
    
Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #17993
    Anh Tran
    Keymaster

    Hi Kiran,

    The post field loads posts via Ajax, and each call loads 10 posts by default. If you want to load all posts (so the Select All/None button work with all of them), please change the code to:

    array(
        'id' => $prefix . 'name',
        'name' => esc_html__( 'All Names', 'text-domain' ),
        'type' => 'post',
        'multiple' => true,
        'post_type' => array( 'names' ),             
        'select_all_none' => true, 
        'field_type' => 'select',
        'query_args' => ['posts_per_page' => -1'],
        'ajax' => false,
    ),
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.

Newsletter

Subscribe to our newsletter to receive news and tutorials for Meta Box and WordPress.


grid gear info copy caret-up caret-down trash