Back to Community

How to Change the 'Add Row' Button Text for CMB2 Repeatable Fields

30 threads Sep 11, 2025 PluginCmb2

Content

If you've used CMB2's powerful repeatable fields, you might have wanted to change the default 'Add New' button text to something more specific to your project. This is a common request, and the method for doing so has evolved over time.

The Problem

By default, CMB2 labels the button for adding a new row in a repeatable field as 'Add New'. For a field collecting email addresses, you might prefer 'Add Another Email'. For a long time, changing this text was not consistently supported across all repeatable field types, leading to confusion.

The Solution

The recommended way to change this text is to use the 'text' parameter within your field configuration array. This parameter was introduced to provide a standardized method for overriding various button and description strings.

Here is an example for a repeatable text field:

$cmb->add_field( array(
    'name' => 'Email Addresses',
    'id'   => '_email_id',
    'type' => 'text',
    'repeatable' => true,
    'text' => array(
        'add_row_text' => 'Add Another Email' // This changes the button text
    )
) );

This method is now the standard and should work for all repeatable field types, including select, text, and others.

Important Note on Legacy Code (The 'options' Array)

You may encounter older code snippets or tutorials that suggest placing the 'add_row_text' override inside an 'options' array. This was a previous method that worked for some field types but was inconsistent. For future compatibility and clarity, it is best to use the new 'text' parameter.

The CMB2 team maintains a comprehensive wiki with field parameters, which is the best place to find the most up-to-date information on functionality like this.

Related Support Threads Support