Hi,
I have a problem with saving data from a cloneable group.
I have the following code;
/**
* Tab: Keuze buttons
*/
array(
'id' => 'buttons',
'clone' => true,
'type' => 'group',
'max_clone' => 3,
'tab' => 'buttons',
'fields' => array(
array(
'name' => 'Titel',
'desc' => '',
'id' => 'button_title',
'type' => 'text',
'size' => 50
),
array(
'name' => 'Link',
'desc' => 'Selecteer de pagina die moet worden weergegeven.',
'id' => 'button_link',
'type' => 'post',
'post_type' => 'page',
'field_type' => 'select_advanced',
'placeholder' => 'Selecteer een pagina',
'query_args' => array(
'post_status' => 'publish',
'posts_per_page' => - 1,
),
),
)
),
When saving the page, the value of 'button_link' is stored in the database. 'button_text' is not saved. I tested this with the following code after all fields are filled in the WP admin;
$buttons = rwmb_meta('buttons', null, get_option('page_on_front'));
foreach($buttons as $button){
echo '<a href="'. get_permalink($button['button_link']) .'"><span>'. $button['button_title'] .'</span></a>';
}
With this result;
Array ( [button_link] => 206 ) Array ( [button_link] => 271 ) Array ( [button_link] => 215 )