Switch not working in MB Group
- This topic has 1 reply, 1 voice, and was last updated 6 years, 7 months ago by
Brian Thurber.
Viewing 2 posts - 1 through 2 (of 2 total)
-
AuthorPosts
-
March 22, 2019 at 3:23 AM #13849
Brian Thurber
ParticipantAll 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; } ?>
March 22, 2019 at 3:36 AM #13850Brian Thurber
ParticipantSorry, for some reason I can't edit the post above. In the top image, the post saves with no errors, in the second photo I get an error.
-
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.