Open mattwatsoncodes opened 6 years ago
I can confirm this bug still exists. Has any work been done to address? I'm not super well-versed in CMB2 but I can offer to help test.
WordPress: 4.9.9 CMB2: 2.6.0
Expected behavior: Using the link_picker
field type in combination with the repeatable
parameter, we can define multiple links in the admin.
Actual behavior: Link fields do show as repeatable fields in the admin, but upon saving only the first item is recorded in the database. Other fields are discarded.
Thanks for this @templeman Ill be happy to help out. Could you post me the code you use to register the repeater so I can work with a like for like example?
@mattwatsoncodes here is how I'm registering the field:
$prefix = 'marketing_slide_';
$marketing_slide_box = new_cmb2_box( array(
'id' => $prefix . 'box',
'title' => esc_html__( 'Marketing Slides', 'cmb2' ),
'object_types' => array( 'moad_marketing_slide' ),
'context' => 'normal',
'priority' => 'high',
'show_names' => true
) );
$marketing_slide_box->add_field( array(
'id' => $prefix . 'hits',
'name' => esc_html__( 'Quick Hits' ),
'type' => 'link_picker',
'repeatable' => true
) );
Thanks for taking a look.
"I’ve tried to add link_picker on repeatable field but it’s not working. Please help about this."
https://wordpress.org/support/topic/repeatable-fields-not-working/