Title: get user_metadata
Last modified: July 31, 2018

---

# get user_metadata

 *  Resolved [melissacrokis](https://wordpress.org/support/users/melissacrokis/)
 * (@melissacrokis)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/get-user_metadata/)
 * Is there a way to get user_metadata in file template? I can user wp_get_current_user()
   to get basic user info but I need get all user info…

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [Josh C](https://wordpress.org/support/users/auth0josh/)
 * (@auth0josh)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/get-user_metadata/#post-10544190)
 * Hi [@melissacrokis](https://wordpress.org/support/users/melissacrokis/),
 * Are you looking for this?
 * [https://developer.wordpress.org/reference/functions/get_user_meta/](https://developer.wordpress.org/reference/functions/get_user_meta/)
 * Is this to pull the Auth0 meta data?
 *  Thread Starter [melissacrokis](https://wordpress.org/support/users/melissacrokis/)
 * (@melissacrokis)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/get-user_metadata/#post-10710738)
 * Yes, I was trying to pull de Auth0 meta data. I solved it with function
 * get_user_meta($user->ID, $wpdb->prefix.’auth0_obj’, true)
 * I get a json object but now I have an encoding problem… Some fields have accents
   characters, like á, é… I can see in MySQL, for example, that é is being replaced
   by u00e9 (without backslash symbol).
 * Could it be a plugin bug while save json in database?
 *  [Josh C](https://wordpress.org/support/users/auth0josh/)
 * (@auth0josh)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/get-user_metadata/#post-10712030)
 * If you’re just pulling out the Auth0 userinfo object, probably best to use:
 *     ```
       $auth0_obj = get_auth0userinfo( $user_id );
       ```
   
 * When saving, we just use `json_encode()` on a standard PHP object. It’s possible
   that the encoding issue in with your database tables but hard to say. We don’t
   do any character transformation before it goes in, though.
    -  This reply was modified 7 years, 8 months ago by [Josh C](https://wordpress.org/support/users/auth0josh/).
 *  Thread Starter [melissacrokis](https://wordpress.org/support/users/melissacrokis/)
 * (@melissacrokis)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/get-user_metadata/#post-10717519)
 * Thanks Josh! I didn’t realize about get_auth0userinfo function.
 * Could you check this thread? I think this is the problem with encoding:
 * [https://wordpress.stackexchange.com/questions/53336/wordpress-is-stripping-escape-backslashes-from-json-strings-in-post-meta](https://wordpress.stackexchange.com/questions/53336/wordpress-is-stripping-escape-backslashes-from-json-strings-in-post-meta)
 * _The update\_metadata() function, which is ultimately responsible for saving 
   the meta, explicitly runs a stripslashes\_deep() on the meta value.”_
 * I changed auth0/lib/WP_Auth0_UsersRepo.php file and I solved my encoding problem,
   but I don’t know if this change could affect another functionality…
 * This is the change (line 194):
 * `update_user_meta( $user_id, $wpdb->prefix . 'auth0_obj', wp_slash(WP_Auth0_Serializer::
   serialize( $userinfo ) ));`
    -  This reply was modified 7 years, 8 months ago by [melissacrokis](https://wordpress.org/support/users/melissacrokis/).
    -  This reply was modified 7 years, 8 months ago by [melissacrokis](https://wordpress.org/support/users/melissacrokis/).
 *  [Josh C](https://wordpress.org/support/users/auth0josh/)
 * (@auth0josh)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/get-user_metadata/#post-10722603)
 * Thanks for the link, useful info for sure, as well as the snippet. It sounds 
   like that’s exactly what’s happening here.
 * I can’t think of any reason that should hurt anything down the road, as long 
   as the data that’s coming back is what you expect. A quick test like this:
 *     ```
       $value = wp_slash('\u00e9');
       update_user_meta( 1, 'testor', $value );
       echo get_user_meta( 1, 'testor', true );
       ```
   
 * … returns the original value so that looks to be sound. I’ll add this to our 
   backlog to get this fix in and run some tests to make sure we get back what we
   expect.
 * Thanks again!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘get user_metadata’ is closed to new replies.

 * ![](https://ps.w.org/auth0/assets/icon-256x256.png?rev=3351758)
 * [Login by Auth0](https://wordpress.org/plugins/auth0/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/auth0/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/auth0/)
 * [Active Topics](https://wordpress.org/support/plugin/auth0/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/auth0/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/auth0/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Josh C](https://wordpress.org/support/users/auth0josh/)
 * Last activity: [7 years, 8 months ago](https://wordpress.org/support/topic/get-user_metadata/#post-10722603)
 * Status: resolved