Validating custom fields on profile page
-
I have added a slew of fields onto the user profile screen and it works–the user or admin can add and edit these custom fields, which are saved as metas. What I would like to accomplish is to use WordPress’s built-in error system, which for instance is used if an invalid email address is entered on the profile screen–you get a red message at the top and the profile isn’t saved.
Here is the basic function:
add_action( ‘personal_options_update’, ‘cwo_save_profile_fields’ );
add_action( ‘edit_user_profile_update’, ‘cwo_save_profile_fields’ );// saves the CWO profile when user hits “update” button
function cwo_save_profile_fields( $user_id ) {
// if data okay, call update_usermeta()// else validation problem, so call error
}I have no problem with the validation, but I cannot seem to get the error call to work properly. Just need some sample code to get going, I think. Thanks!
- The topic ‘Validating custom fields on profile page’ is closed to new replies.