Support » Plugin: Meta Box - WordPress Custom Fields Framework » Group field disappearing after updating post

  • Resolved themugician

    (@themugician)


    I created a group field.
    And I can add multiple fields.
    After I press update to update the post all my fields disappear except for one.
    Can you please check in my code to see what the issue might be.

    
    <pre><code><?php
    /**
     * Registers the splash pricing plan post type.
     *
     */
    function splash_location_custom_post_type() {
      register_post_type('splash_location',
        array(
          'labels'      => array(
            'name'          => __('Locations', 'textdomain'),
            'singular_name' => __('Location', 'textdomain'),
          ),
          'supports' => array( 'title', 'custom-fields' ),
          'menu_icon'   => 'dashicons-admin-page',
          'public'      => true,
          'has_archive' => true,
          'show_in_rest' => true,
         )
      );
    }
    add_action('init', 'splash_location_custom_post_type');
    
    add_filter( 'rwmb_meta_boxes', 'splash_register_location_info_meta_boxes' );
    function splash_register_location_info_meta_boxes( $meta_boxes ) {
      $meta_boxes[] = [
        'title'      => 'Main info',
        'post_types' => 'splash_location',
    
        'fields' => [
          [
            'name'  => 'Location title',
            'id'    => 'splash_location_title',
            'type'  => 'text',
          ],
          [
            'name'  => 'Location description',
            'id'    => 'splash_location_description',
            'type'  => 'textarea',
          ],      
          // More fields.
        ]
      ];
    
      $meta_boxes[] = [
        'title'      => 'Hours',
        'post_types' => 'splash_location',
    
        'fields' => [
          [
            'name'  => 'Schedule',
            'id'    => 'splash_location_schedule',
            'clone' => 'true',
            'add_button' => '+ Add a schedule',
            'type'  => 'group',
            'fields' => [
    		      [
    		        'name'  => 'Location schedule details',
    		        'id'    => 'details',
    		        'type'  => 'text',
    		      ],
    		    ],
          ],
        ]
      ];
    
      return $meta_boxes;
    }
    • This topic was modified 2 months, 3 weeks ago by themugician.
    • This topic was modified 2 months, 3 weeks ago by themugician.
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.