1. Home
  2. Snippets
  3. Change required field indicator

Change required field indicator

Heads up!

This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.

Dismiss

When a field is required in WPForms, a red asterisk will be displayed at the end of the field label.

Red asterisk marks required fields

To replace this asterisk with a different symbol or text, you’ll need to add the code snippet below to your site.

As an example in this code, we’ll modify the required field indicator to display “(Required)”.

/**
 * Modify the required field indicator
 *
 */
function wpf_dev_required_indicator( $text ) {
	return ' <span class="wpforms-required-label">(Required)</span>';
}
add_filter( 'wpforms_field_required_label', 'wpf_dev_required_indicator' );

Example of custom indicator for required field

Updated on April 12, 2018

Was this article helpful?