WordPress.org

Support

Support » Plugins and Hacks » Hacks » Get_user_meta not working in my plugin

Get_user_meta not working in my plugin

  • i am using get_user_meta() function in my plugin but it is not showing any values for usermeta table, it is showing blank result.

    I am able to see the value present in phpmyadmin. I am using it in a plugin add_action(‘user_register’,’user_sf_lead’), but it is not showing any value in my code.

    I am able get all the value of USER table but no values from USERMETA table in my plugin.

    When updating my user i am able to get all values.

    How to get values from get_user_meta while using action hook
    add_action(‘user_register’,’user_sf_lead’)

    Also when get_userdata , i getting values from USER table but not from USERMETA table.

    $user_info = get_userdata($user_id);
    'Name' => $user_info->ID,
    'First_Name__c' => $user_info->first_name,

    Provide solution??

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    @bcworkz

    It sounds like a cache somewhere is not getting updated. When you add user metadata, WP deletes the old associated cache, forcing a refresh when you use get_user_meta(). There could be other caches in play, perhaps placed by your host. If you cannot determine how to refresh all caches involved, go straight to the DB and get the data using $wpdb methods. Not as efficient as caches, but more reliable.

Viewing 1 replies (of 1 total)
  • The topic ‘Get_user_meta not working in my plugin’ is closed to new replies.
Skip to toolbar