A
A
Artemy Zheman2015-12-22 21:47:06
WordPress
Artemy Zheman, 2015-12-22 21:47:06

How to perform an action when user's meta data is updated?

A strange question for sure.
The user has meta data.
Multiple fields.
You need to make sure that when you update a certain field, for example this.
c2n.me/3s6jmY7
Perform some action.
Well, in general, even a script of a couple of lines. How would it be implemented?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MetaDone, 2015-12-25
@artyom_jeman

add_action( 'personal_options_update', 'my_save_extra_profile_fields' );
add_action( 'edit_user_profile_update', 'my_save_extra_profile_fields' );

function my_save_extra_profile_fields( $user_id ) {
  if ( !current_user_can( 'edit_user', $user_id ) )
    return false;
//здесь ваши действия
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question