Custom Fields
Support MB Custom Table Bug (maybe) MB Custom Table with Select Advanced field

  • Creator
  • #22870
    Resolved Trang Nguyen

    Maybe there is a bug when using MB Custom Table with Select Advanced fields (multiple).

    When I write
    $values = rwmb_meta( $field_id );
    echo count($values);

    It always shows 1 unit more than the actual result.

    For example:
    I have 2 select advanced fields (multiple) A and B.
    - A saves data in postmeta
    - B saves data in a custom table.

    I choose 2 items for each field when writing post.
    With similar echo count($values) code, I get:
    - A: 2 (correct)
    - B: 3 (incorrect, there are only 2 items)

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
  • #22871
    Trang Nguyen

    There is another similar issue with Custom Table and Post field with multiple choices:

    If a post field saves data to a custom table, it also saves 'i:0;s:0:""' before other items.
    I choose 2 posts and this is the data I have in the database

    Because of this, when I use this code

    $post_ids = rwmb_meta( $field_id, ['storage_type' => 'custom_table', 'table' => $table_name] );
    foreach ( $post_ids as $post_id ) {
        echo '<p>', get_the_title( $post_id ), '</p>';

    It shows as I have 3 posts, not 2.

    Long Nguyen


    I'm going to check it out and let you know later.

    Thank you.

    Long Nguyen

    This issue has been fixed in the new version of MB Custom Table v1.1.11. I'm going to mark this topic as Resolved.

    Trang Nguyen

    Many thanks, Long
    Have a nice weekend!

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