This happens just after the registration form is validated. It allows you to show errors for custom fields you have added.
Parameters:
- $_POST - Array of all information sent with the form.
Example:
This example shows adding a custom registration field (checkbox) with rcp_after_register_form_fields and validation that sets an error if the checkbox isn't checked.
/** * Add checkbox to registration form. * * @return void */ function ag_rcp_after_register_form_fields() { ?> <p> <input name="rcp_sample_required_field" id="rcp_sample_required_field" type="checkbox" checked="checked"/> <label for="rcp_sample_required_field">Your field label*</label> </p> <?php } add_action(' rcp_after_register_form_fields', 'ag_rcp_after_register_form_fields' ); /** * Validate form submission and add an error if checkbox isn't checked. * * @param array $posted Array of information sent to the form. * * @return void */ function ag_rcp_form_errors( $posted ) { if( ! isset( $posted['rcp_sample_required_field'] ) ) { rcp_errors()->add( 'sample_field_required', __( 'You must check this field', 'rcp' ), 'register' ); } } add_action( 'rcp_form_errors', 'ag_rcp_form_errors' );