Hi,
I had a problem in changing the text of the clone button, using your following snippet:
add_filter( 'rwmb_group_add_clone_button_text', 'prefix_group_add_clone_button_text', 10, 2 );
function prefix_group_add_clone_button_text( $text, $field ) {
// If you want to change text by field, you can do something like this
if ( 'group_id' == $field['id'] ) {
$text = __( '+ Add more chapter', 'textdomain' );
}
// return $text;
}
In order to solve the problem, I edited the meta-box/inc/clone.php by changing $field['add_button'] to $field.
/**
* Add clone button.
*
* @param array $field Field parameters.
* @return string $html
*/
public static function add_clone_button( $field ) {
if ( ! $field['clone'] ) {
return '';
}
$text = RWMB_Field::filter( 'add_clone_button_text', $field['add_button'] ); // <---
return '<a href="#" class="rwmb-button button-primary add-clone">' . esc_html( $text ) . '</a>';
}
I'm not sure if I am doing right thing and if this is a bug. If that's the case, it would be great if you could update the plugin. Otherwise, could you please suggest me how to manage this issue?
Thanks