rcp_edit_profile_form_errors

Triggers after the update profile form has been checked for errors. You can use this hook to validate your custom fields and add your own errors if they're not filled out.

Parameters:

  • $post (array) - Array of information sent via $_POST through the form.
  • $user_id (int) - ID of the user who is updating their profile.

Example:

Adds an error if a custom field isn't filled out.

function ag_rcp_edit_profile_form_errors( $post, $user_id ) {
	if ( empty( $post['my_custom_field'] ) ) {
		rcp_errors()->add( 'custom_field_empty', __( 'The custom field must be filled out.', 'rcp' ) );
	}
}
add_action( 'rcp_edit_profile_form_errors', 'ag_rcp_edit_profile_form_errors', 10, 2 );
Powered by Zendesk