Skip to content

Documentation

Extensive Documentation for PowerPack & WooPack to help you with common questions and issues.

PowerPack

  1. Home
  2. Docs
  3. PowerPack
  4. Modules
  5. Subscribe Form
  6. How to change validation and error messages?

How to change validation and error messages?

You can change / update validation and error messages via a filter available in PowerPack’s Subscribe Form module i.e. pp_subscribe_form_strings_i18n introduced in v2.12.0

Please add the following code in your current theme’s functions.php file:

add_filter( 'pp_subscribe_form_strings_i18n', 'change_pp_subscribe_form_strings' );
	function change_pp_subscribe_form_strings( $strings ) {
		// To change the text "Please wait..."
		$strings['wait_text'] = 'Your custom text...';
		// To change form error "Something went wrong. Please check your entries and try again."
		$strings['form_error'] = 'Your custom text for form error.';
		// To change unknown error "There was an error subscribing. Please try again."
		$strings['unknown_error'] = 'Your custom text for unknown error.';
		// To change validation message for checkbox "Please check the required field.".
		$strings['not_checked'] = 'Your custom text for not checked.';
		// To change empty or invalid email text "Please enter a valid email address."
		$strings['empty_invalid_email'] = 'Your custom text for empty or invalid email.';
		// To change empty name text "Please enter your name."
		$strings['empty_name'] = 'Your custom text.';

		return $strings;
	}

Was this article helpful to you? Yes No

How can we help?

×