Custom Fields
Re-Envisioned
Support General Clonable post type field count not zero with nothing selected

  • Creator
    Topic
  • #16297
    Resolved Yumikom
    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,

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #16308
    Anh 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
    Yumikom
    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 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.