Clonable post type field count not zero with nothing selected

Support General Clonable post type field count not zero with nothing selectedResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #16297
    YumikomYumikom
    Participant

    Hi,

    I'm using post type metabox with 'clone' and 'sort' option.
    I haven't selected any posts, but rgm_meta has zeros in the array.

    Get filed Value:

    $posts_related = rwmb_meta( 'post_related', array(), $id );
    var_dump($posts_related);
    array(1) {
      [0]=>
      int(0)
    }

    I want the array to be empty if nothing is selected.

    Field settings:

    array (
        'id' => 'post_related',
        'type' => 'post',
        'name' => 'title',
        'post_type' => array(
            0 => 'post-type-1',
            1 => 'post-type-2',
            2 => 'post-type-3',
        ),
        'field_type' => 'select_advanced',
        'clone' => 1,
        'sort_clone' => 1,
    ),

    *I can select multiple in Select Advanced, but I can't change the order, so I use a 'clone'.

    Regards,

    #16308
    Anh TranAnh Tran
    Keymaster

    Hi, thanks a lot for your feedback. It's a bug in the sanitization callback, which I've just fixed here. Please try it.

    #16313
    YumikomYumikom
    Participant

    Hi Anh,

    I'm thankful for your quick debugging.
    When I was save post again, I could confirm that post type select field array value is emptied.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.