WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have created a custom user meta field, and that value is being used to get data from an external API and display it on the user profile page. On admin pages I have used the following code to make sure that when an administrator account views a user profile, s/he can view the data displayed from the API.

And then calling the API, and retrieving the cached data from a transient prefixed by the user id yadadada. This all works perfectly, and the data displays properly. But if the administrator then tries to update another user's account custom meta field despite the fact that I pass the correct userid to the update_user_meta function, meta value does not update. Below is the code for the update function.

function af_askFRED_update_fencer_field() {
    $user = wp_get_current_user();
    $userid = $user->ID;

    if (current_user_can('delete_users') && isset($_GET['user_id'])) {
        $userid = $_GET['user_id'];

    $usfaID = $_POST['af_askFRED_usfaID'];
    update_user_meta($userid, 'af_askFRED_usfaID', $usfaID);


add_action('personal_options_update', 'af_askFRED_update_fencer_field');

NOTE: If I update any other profile field it works perfectly.

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.