- This topic has 1 reply, 1 voice, and was last updated 1 year, 11 months ago by .
-
Topic
-
All plugins are up to date. I have two switch form fields in a meta box group. When I toggle one of the switches, the post gets saved just fine. When I leave both switches un-toggled and save the post, I get an error which reads: Warning: Invalid argument supplied for foreach() in /home/umcgot/public_html/wp-content/plugins/meta-box-group/class-rwmb-group-field.php on line 240
The switches work fine outside of the group.
Thanks for your help! -Brian
<?php add_filter( 'rwmb_meta_boxes', 'prefix_register_meta_boxes' ); function prefix_register_meta_boxes( $meta_boxes ) { $prefix = 'umc_got_'; $meta_boxes[] = array( 'id' => 'umc_got', 'title' => 'Game Of Thrones', 'post_types' => 'umc_got_bracket', 'context' => 'normal', 'priority' => 'high', 'fields' => array( array( 'name' => 'Group', // Optional 'id' => 'group_id', 'type' => 'group', // List of sub-fields 'fields' => array( array( 'id' => 'jon_snow', 'name' => 'Jon Snow / Targaryen', 'type' => 'switch', 'style' => 'square', 'on_label' => '<i class="dashicons dashicons-yes"></i>', 'off_label' => 'Alive', 'class' => 'umc_got_switch', 'columns' => 4 ), array( 'id' => 'daenerys', 'name' => 'Daenerys Targaryen', 'type' => 'switch', 'style' => 'square', 'on_label' => 'Dead', 'off_label' => 'Alive', 'class' => 'umc_got_switch', 'columns' => 4 ), ), ), ) ); return $meta_boxes; } ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- You must be logged in to reply to this topic.