Title: Get user all meta data
Last modified: August 30, 2016

---

# Get user all meta data

 *  Resolved [mkiisoft](https://wordpress.org/support/users/mkiisoft/)
 * (@mkiisoft)
 * [11 years ago](https://wordpress.org/support/topic/get-user-all-meta-data/)
 * Hello, everyone.
 * There is a way to get ALL user meta data? Even custom meta keys and values.
 * I’m using this snippet:
 * function playWithMeta($postray, $postdat, $context){
    $morestuff = get_post_meta(
   $postdat[‘ID’]); //don’t do this, you will probably be duplicating a bunch of
   stuff return array_merge($postray, $morestuff); } add_filter( ‘json_prepare_post’,‘
   playWithMeta’,12, 3 );
 * But I think this is only por “/posts”. I’ll need the same but for users.
 * Thanks in advance!
 * [https://wordpress.org/plugins/json-rest-api/](https://wordpress.org/plugins/json-rest-api/)

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

 *  Thread Starter [mkiisoft](https://wordpress.org/support/users/mkiisoft/)
 * (@mkiisoft)
 * [11 years ago](https://wordpress.org/support/topic/get-user-all-meta-data/#post-6387258)
 * Never mind… use this:
 * add_filter( ‘json_prepare_user’, ‘add_user_metadata’, 10, 3 );
 * function add_user_metadata( $user_fields, $user, $context ) {
    add_author_meta_field(
   $user_fields, ‘user_coins’ ); return $user_fields; }
 * function add_author_meta_field( &$user_fields, $field ) {
    if ( $meta = get_the_author_meta(
   $field, $user_fields[‘ID’] ) ) { $user_fields[ $field ] = $meta; } }
 * and “add_author_meta_field” for every meta key you need.
 * Hope that helps someone else!
 *  Thread Starter [mkiisoft](https://wordpress.org/support/users/mkiisoft/)
 * (@mkiisoft)
 * [11 years ago](https://wordpress.org/support/topic/get-user-all-meta-data/#post-6387261)
 * BTW… how can I make a POST request to a custom meta key?
 * mydomain.com/wp-json/users/1?data[my_meta_key]=2500
 * is not working… any hint for that?
 * EDIT: I also try [http://wp-api.org/#posts_create-meta-for-a-post](http://wp-api.org/#posts_create-meta-for-a-post)
   without any luck. Is a lack of info in that with the endpoint
 * Should be something like this: my-domain.com/wp-json/posts/1223/meta?data[my_meta_key]
   =2500
 * of what???
 * PS: Every other “native” meta key is working with POST request and I can edit
   it.
 *  Thread Starter [mkiisoft](https://wordpress.org/support/users/mkiisoft/)
 * (@mkiisoft)
 * [11 years ago](https://wordpress.org/support/topic/get-user-all-meta-data/#post-6387491)
 * If someone need it:
 * user Basic Auth (or any other Auth), then:
 * my-domain.com/wp-json/posts/IDofPost/meta/MetaID
 * the use value pair to upload the value of it. Normally, having the ID of the 
   Meta, you only need to pass: value=Example
 * if you want to use full endpoint is:
 * my-domain.com/wp-json/posts/IDofPost/meta/MetaID?data[value]=Example
 * PS: Change IDofPost and MetaID for the values you need. Check your meta response
   to know which one you need to edit.

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

The topic ‘Get user all meta data’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/json-rest-api_2e3641.svg)
 * [WP REST API (WP API)](https://wordpress.org/plugins/json-rest-api/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/json-rest-api/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/json-rest-api/)
 * [Active Topics](https://wordpress.org/support/plugin/json-rest-api/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/json-rest-api/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/json-rest-api/reviews/)

## Tags

 * [meta key](https://wordpress.org/support/topic-tag/meta-key/)
 * [user](https://wordpress.org/support/topic-tag/user/)
 * [wp rest api](https://wordpress.org/support/topic-tag/wp-rest-api/)

 * 3 replies
 * 1 participant
 * Last reply from: [mkiisoft](https://wordpress.org/support/users/mkiisoft/)
 * Last activity: [11 years ago](https://wordpress.org/support/topic/get-user-all-meta-data/#post-6387491)
 * Status: resolved