- This topic has 2 replies, 3 voices, and was last updated 6 days, 9 hours ago by .
-
Topic
-
Hi,
I have a custom group using the code below.
as can be seen, the switch ‘std’ value is true, which should render the switch as on, by default but renders off.Case 2:
A few days ago I had another situation where ‘std’ was on, the group in which the switch was in was cloneable. The first switch was on, but when I cloned the parent group, the other switch buttons were off. I could not reproduce this case as I cannot remember the exact settings.function user_stores( $meta_boxes ) { $prefix = ''; $meta_boxes[] = [ 'title' => __( 'User Stores', 'your-text-domain' ), 'id' => 'custom-fields-group-user-stores', 'type' => 'user', 'fields' => [ [ 'name' => __( 'User Stores', 'your-text-domain' ), 'id' => $prefix . 'user_stores', 'type' => 'group', 'clone' => true, 'clone_as_multiple' => true, 'add_button' => __( 'Add Store', 'your-text-domain' ), 'fields' => [ [ 'name' => __( 'Store', 'your-text-domain' ), 'id' => $prefix . 'store', 'type' => 'post', 'post_type' => ['store'], 'field_type' => 'select_advanced', 'required' => true, ], [ 'name' => __( 'Active', 'your-text-domain' ), 'id' => $prefix . 'active', 'type' => 'switch', 'std' => true, ], ], ], ], ]; return $meta_boxes; }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.