Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The word 'false' is saved in empty text repeater fields in v2.4.0 #1138

Closed
lumpysimon opened this issue May 25, 2018 · 7 comments
Closed

The word 'false' is saved in empty text repeater fields in v2.4.0 #1138

lumpysimon opened this issue May 25, 2018 · 7 comments

Comments

@lumpysimon
Copy link

This issue affects v2.4.0 but not v2.3.0

When adding new items to a repeater text field and leaving them blank, the items should not be saved. In v2.4.0 the items are saved and contain the word false. This means when displaying the field values on the front end, the word false is returned and displayed.

To reproduce:

  • Create a field with 'type' => 'text' and 'repeatable' => true
  • Add an item to the field with a value in it
  • Add a second item with no value
  • Save the post
  • The second item will contain the word false

screen shot 2018-05-25 at 09 13 35

@jtsternberg
Copy link
Member

Fixed in 2.4.1. Thank you for the helpful bug report.

@JiveDig
Copy link

JiveDig commented May 26, 2018

@jtsternberg I'm testing 2.4.1 now and still getting false in a repeatable WYSIWYG field. Tested on 2 different installs. If I add 'default' => '', to the WYSIWYG field, then it's fine.

@jtsternberg
Copy link
Member

@JiveDig as always, can you pretty please provide your configuration code so we can test w/ the same thing?

@JiveDig
Copy link

JiveDig commented May 29, 2018

Sorry @jtsternberg, I think i was too excited for 🍺 on Memorial Day weekend ;P

add_action('cmb2_init', function() {

	$cmb = new_cmb2_box([
		'id'           => 'test',
		'title'        => 'Test',
		'object_types' => ['post'],
		'context'      => 'normal',
		'priority'     => 'default'
	]);

	$group_field_id = $cmb -> add_field([
		'id'   => 'group',
		'type' => 'group'

	]);

	$cmb->add_group_field( $group_field_id, array(
		'name' => __( 'Content', 'textdomain' ),
		'id'   => 'content',
		'type' => 'wysiwyg',
	) );

}, 20, 2 );

@jtsternberg
Copy link
Member

Ha, I hear that. It should be fixed with 2.4.2. Please let me know.

@JiveDig
Copy link

JiveDig commented May 29, 2018

Yessir, works in 2.4.2 thanks!

@lumpysimon
Copy link
Author

Thanks @jtsternberg for the quick fix on this, all working great again now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants