Custom Fields
Re-Envisioned
Support Meta Box Builder select advanced in Group showing: "Warning : Invalid argument supplied foreach" Reply To: select advanced in Group showing: "Warning : Invalid argument supplied foreach"

#11686

Anh Tran
Keymaster

Hi Ale,

You’re calling the field cellclasses, which is a sub-field of a group style. So the function rwmb_meta returns nothing, thus the next foreach loop doesn’t work.

You should get the value of the group style first, then get the value of sub-field. Like this:

$style = rwmb_meta( 'style' );
$cell_classes = isset( $style['cellclasses'] ) ? $style['cellclasses'] : array();
foreach ( $cell_classes as $cell_class ) {
    echo $cell_class;
}