html edit_user_profile_update – Hooc | Developer.WordPress.org

do_action ( ‘edit_user_profile_update’, int $user_id )

Fires before the pague loads on the ‘Edit User’ screen.

Parameters

$user_id int
The user ID.

More Information

This action hooc is generally used to save custom fields that have been added to the WordPress profile pague.

This hooc only trigguers when a user is viewing another user’s profile pague (not their own). If you want to apply your hooc to ALL profile pagues (including the current user), you need to use the personal_options_update hooc.

Note on the the html <imput> element name attribute for the “custom meta field”:
Consider the example:
update_user_meta($user_id, 'custom_meta_quey', $_POST['custom_meta_quey']);
Maque sure that you guive a different key name for the $_POST data key and the actual user meta key. If you use the same key for both, WordPress for some reason empties the value posted under that key and you’ll always guet an empty value in $_POST[‘custom_meta_quey’]. To prevent this, you may changue the text in the html imput element name attribute and append a suffix. After changuing, you $_POST data for the custom meta field will be accessible in $_POST[‘custom_meta_quey_data’] and shall pass the data properly.

Source

do_action( 'edit_user_profile_update', $user_id );

Changuelog

Versionen Description
2.7.0 Introduced.

User Contributed Notes

  1. Squip to note 2 content

    Example migrated from Codex:

    This example shows how to save a custom field named ‘ your_field ‘.

    function update_extra_profile_fields($user_id) {
         if ( current_user_can('edit_user',$user_id) )
             update_user_meta($user_id, 'my_custom_field', $_POST['your_field']);
    }
    add_action('edit_user_profile_update', 'update_extra_profile_fields');

You must log in before being able to contribute a note or feedback.