meta-box icon indicating copy to clipboard operation
meta-box copied to clipboard

Meta Box Group Item not saving fields

Open imjameshall opened this issue 8 years ago • 1 comments

Hey there.

I have an issue where a sortable group is not saving items for some reason or another.

My group has a few text fields and an image field. All of them work okay enough but they end up after a while not saving the information.

Before Entry: https://www.dropbox.com/s/kbky2cc6sljc9ci/Screenshot%202017-08-16%2016.42.25.png?dl=0

After Entry, before updating: https://www.dropbox.com/s/7f29jqfeobu14fv/Screenshot%202017-08-16%2016.42.36.png?dl=0

After updating: https://www.dropbox.com/s/cu5ut64avsdrhx8/Screenshot%202017-08-16%2016.42.50.png?dl=0

Heres the code for this part of the metabox:

      'title'      => __( 'Milestones Area', 'rwmb' ),
      'post_types' => 'page',
      'fields'     => array(
        array(
          'id'      => 'milestone_heading',
          'name'    => __( 'Heading', 'textdomain' ),
          'type'    => 'text'
        ),
        array(
          'id'     => 'milestones',
          // Group field
          'type'   => 'group',
          // Clone whole group?
          'clone'  => true,
          // Drag and drop clones to reorder them?
          'sort_clone' => true,
          // 'max_clone' => '6',
          'title' => 'Milestones',
          // Sub-fields
          'fields' => array(
            array(
      		'id'          => 'location_number',
      		'name'        => 'Percentage',
      		'type'        => 'number',
      		// Number step. Set to 'any' to accept float value
      		'step'        => 'any',
      		// Minimum value
      		'min'         => 0,
             'max'         => 100,
      		// Placeholder
      		'placeholder' => __( 'Enter number (1-100):', 'your-prefix' ),
      	),
            array(
              'name' => __( 'Milestone Title', 'rwmb' ),
              'id'   => 'milestone_title',
              'type' => 'text',
            ),
            array(
              'name' => __( 'Milestone Header', 'rwmb' ),
              'id'   => 'milestone_header',
              'type' => 'text',
            ),
            array(
              'name' => __( 'Milestone Text', 'rwmb' ),
              'id'   => 'region_text',
              'type' => 'textarea',
            ),
            array(
              'id'   => 'item_bg',
              'name' => __( 'Milestone Image', 'textdomain' ),
              'type' => 'image_advanced',
              'desc' => 'Image / Video used for background image. BG Size: min 1440px.'
            ),
            array(
      				'name'    => 'Text Alignment',
      				'id'      => 'radio',
      				'type'    => 'radio',
      				// Array of 'value' => 'Label' pairs for radio options.
      				// Note: the 'value' is stored in meta field, not the 'Label'
      				'options' => array(
      					'top-align' => 'Top Aligned',
      					'bottom-align' => 'Bottom Aligned',
      				),
			),
          ),
        ),
      )
    );```


Any thoughts on what could be wrong? I've had this happen a few times with the group extension, where the only way to seemingly fix it is to rename the ID and start all over.

imjameshall avatar Aug 16 '17 20:08 imjameshall

What versions of WordPress and the plugin are you using?

funkatron82 avatar Sep 21 '17 02:09 funkatron82