Title: mkiisoft's Replies | WordPress.org

---

# mkiisoft

  [  ](https://wordpress.org/support/users/mkiisoft/)

 *   [Profile](https://wordpress.org/support/users/mkiisoft/)
 *   [Topics Started](https://wordpress.org/support/users/mkiisoft/topics/)
 *   [Replies Created](https://wordpress.org/support/users/mkiisoft/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/mkiisoft/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/mkiisoft/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/mkiisoft/engagements/)
 *   [Favorites](https://wordpress.org/support/users/mkiisoft/favorites/)

 Search replies:

## Forum Replies Created

Viewing 15 replies - 1 through 15 (of 24 total)

1 [2](https://wordpress.org/support/users/mkiisoft/replies/page/2/?output_format=md)
[→](https://wordpress.org/support/users/mkiisoft/replies/page/2/?output_format=md)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP REST API (WP API)] Possible to get a small subset of values in JSON?](https://wordpress.org/support/topic/possible-to-get-a-small-subset-of-values-in-json/)
 *  [mkiisoft](https://wordpress.org/support/users/mkiisoft/)
 * (@mkiisoft)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/possible-to-get-a-small-subset-of-values-in-json/#post-6483811)
 * Hello slegg!
 * You could use WP REST API Filter Fields plugin to do that and use it like “&fields
   =ID,title,author,bla bla” at the end of the endpoint to only get those values.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP REST API (WP API)] How to get Event Json route ?](https://wordpress.org/support/topic/how-to-get-event-json-route/)
 *  [mkiisoft](https://wordpress.org/support/users/mkiisoft/)
 * (@mkiisoft)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/how-to-get-event-json-route/#post-6487868)
 * Hello matheo972!
 * As far as I see… [http://www.site.fr/wp-admin/edit.php](http://www.site.fr/wp-admin/edit.php)?
   >>>> post_type=tribe_events <<<<
 * is a Post Type and not a category… post type are getting like this:
 * yourwebsite.com/wp-json/posts?type=tribe_events
 * and to get a Taxonomy, you must use: “filter[taxonomy]=your_taxonomy”
 * example of full website with and without custom post and both using custom category:
 * (with custom post type) yourwebsite.com/wp-json/posts?type=your_post_type&filter[
   taxonomy]=your_taxonomy
 * (without custom post type) yourwebsite.com/wp-json/posts?filter[taxonomy]=your_taxonomy
 * hope that helps you. (with v2 you must go to v2 plugin site… or add “/wp-json/
   wp/v2/” instead of just “/wp-json/” to my endpoints.
 * Remember to replace “yourwebsite.com” with your actual website and “your_post_type”
   and “your_taxonomy” with the same logic.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP REST API (WP API)] Updates change all my code customisations](https://wordpress.org/support/topic/updates-change-all-my-code-customisations/)
 *  [mkiisoft](https://wordpress.org/support/users/mkiisoft/)
 * (@mkiisoft)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/updates-change-all-my-code-customisations/#post-6477684)
 * WordPress plugin updates always override every single file… It doesn’t ask you
   to keep some/any modify files.
 * If you want to keep your changes, use FTP to upload the files and DON’T override
   your custom files (but you’ll need to check them anyway if something is needed
   for the new update… every single time)
 * Other similar approach is to change the plugin folder name and manually “update”
   new files and keep your changes.
 * You should always have a backup of your custom code for 3rd party plugins (and
   1st party ones… any plugin that is not yours)
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP REST API (WP API)] re](https://wordpress.org/support/topic/re-4/)
 *  [mkiisoft](https://wordpress.org/support/users/mkiisoft/)
 * (@mkiisoft)
 * [11 years ago](https://wordpress.org/support/topic/re-4/#post-6444555)
 * Hello firas.
 * You need to use it like this:
 * your-url-goes-here.com/wp-json/posts?type=your-custom-post-type
 * Change your-url-goes-here.com with your actual URL and your-custom-post-type 
   with your post type.
 * Example:
 * amazingwebsite.com/wp-json/posts?type=coins (for example… this is a fake url,
   of course)
 * Remember that always after /posts, /users, /media goes a “?” and the next endpoint
   filter goes with “&”… so, If you can to put the post type at last… goes like 
   this:
 * amazingwebsite.com/wp-json/posts?filter[s]=Hello!&type=coins
 * Then, you search all “Hello!” inside custom post type: coins
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP REST API (WP API)] How to write custom(my own) api in WP REST API Plugin?](https://wordpress.org/support/topic/how-to-write-custommy-own-api-in-wp-rest-api-plugin/)
 *  [mkiisoft](https://wordpress.org/support/users/mkiisoft/)
 * (@mkiisoft)
 * [11 years ago](https://wordpress.org/support/topic/how-to-write-custommy-own-api-in-wp-rest-api-plugin/#post-6356823)
 * Hello [@damienoneill2001](https://wordpress.org/support/users/damienoneill2001/)
 * You need to change the level permission for that… that would be the “10” at the
   end. Try using 12, 2, 4 or similar. 2 works for me in some cases.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP REST API (WP API)] Get user all meta data](https://wordpress.org/support/topic/get-user-all-meta-data/)
 *  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.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP REST API (WP API)] Get user all meta data](https://wordpress.org/support/topic/get-user-all-meta-data/)
 *  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.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP REST API (WP API)] Get user all meta data](https://wordpress.org/support/topic/get-user-all-meta-data/)
 *  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!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP REST API (WP API)] Issue on Post](https://wordpress.org/support/topic/issue-on-post/)
 *  [mkiisoft](https://wordpress.org/support/users/mkiisoft/)
 * (@mkiisoft)
 * [11 years ago](https://wordpress.org/support/topic/issue-on-post/#post-6337794)
 * Hello mnavaidd.
 * Quotation marks are reserved for meta keys and values… normally, quotes ‘ll look
   like this \” or &#34 or u0022 (and maybe others). You have the full list here:
   [http://www.fileformat.info/info/unicode/char/0022/index.htm](http://www.fileformat.info/info/unicode/char/0022/index.htm)
 * Also, inside html tags (for your content), quotes are also reserved and can be“
   normally used”… and it’ll look like the ones I’ve already told you.
 * Most languages and mobile OS ‘ll understand the \” and &#34… maybe you need a
   replace string for u0022
 * When you parse a Json Response… the json parser removes all quotes from the meta
   keys and values and only get the info inside of each.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP REST API (WP API)] get posts by category, but the array is empty](https://wordpress.org/support/topic/get-posts-by-category-but-the-array-is-empty/)
 *  [mkiisoft](https://wordpress.org/support/users/mkiisoft/)
 * (@mkiisoft)
 * [11 years ago](https://wordpress.org/support/topic/get-posts-by-category-but-the-array-is-empty/#post-6368354)
 * Hello igiaki! Please, check your meta info every time you check a category name.
 * Your category ID 55 is “artisti” and the meta you need to check is either “artisti”
   or 54 (again, check your meta info).
 * The endpoint you are looking for is this one:
 * vision-club.it/wp-json/posts?filter[category_name]=artisti&filter[post_per_page]
   =10&page=1
 * Hope that helps 😉
 * PS: add “[http://www.&#8221](http://www.&#8221); normally, wp forum remove the[]
   brackets if you add the first part of the url.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP REST API (WP API)] How to write custom(my own) api in WP REST API Plugin?](https://wordpress.org/support/topic/how-to-write-custommy-own-api-in-wp-rest-api-plugin/)
 *  [mkiisoft](https://wordpress.org/support/users/mkiisoft/)
 * (@mkiisoft)
 * [11 years ago](https://wordpress.org/support/topic/how-to-write-custommy-own-api-in-wp-rest-api-plugin/#post-6356740)
 * Then, use this next snippet over fuctions.php (of your theme) or download the
   plugin “Code Snippets” (save and activate to make it work):
 * function remove_extra_data( $data, $post, $context ) {
    // We only want to modify
   the ‘view’ context, for reading posts if ( $context !== ‘view’ || is_wp_error(
   $data ) ) { return $data; }
 *  // Here, we unset any data we don’t want to see on the front end:
 *  unset( $data[‘meta’] );
 *  // To unset tree nested specific data, you need to declare the
    // “parent” 
   key and then the actual key, for example: // unset( $data[‘author’][‘description’]);//
   unset( $data[‘author’][‘URL’] ); // that’ll only unset description and URL inside
   author. // continue unsetting whatever other fields you want
 *  return $data;
    }
 * add_filter( ‘json_prepare_post’, ‘remove_extra_data’, 12, 3 );
 * Tell me if that works! 🙂
 * PS: If you want to build an app… meta info is a good for you. You can actually
   check it from the json response and not saving that data locally on you app. 
   If the meta URL changes, you’ll have to update the entire app.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP REST API (WP API)] Custom Fields not included with Taxonomies](https://wordpress.org/support/topic/custom-fields-not-included-with-taxonomies/)
 *  [mkiisoft](https://wordpress.org/support/users/mkiisoft/)
 * (@mkiisoft)
 * [11 years ago](https://wordpress.org/support/topic/custom-fields-not-included-with-taxonomies/#post-6317759)
 * Sup, Dave! I’m also using ACF and this is the best way to add meta keys from 
   it to the json response:
 * function custom_meta_name( $post_response, $post, $context ) {
 *  $valueone = get_field( “name-value-one”, $post[‘ID’] );
    $valuetwo = get_field(“
   name-value-two”, $post[‘ID’] );
 *  $post_response[value_one] = $valueone;
    $post_response[value_two] = $valuetwo;
 *  return $post_response;
    } add_filter( ‘json_prepare_post’, ‘custom_meta_name’,
   10, 3 );
 * INFO: name-value-one is your actual key from ACF, check the names you use for
   it and [value_one] is any name you want to “print” on the Json response
 * Add it on functions.php or with “Code Snippets” plugin. Cheers!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP REST API (WP API)] How to get post category name](https://wordpress.org/support/topic/how-to-get-post-category-name/)
 *  [mkiisoft](https://wordpress.org/support/users/mkiisoft/)
 * (@mkiisoft)
 * [11 years ago](https://wordpress.org/support/topic/how-to-get-post-category-name/#post-6356119)
 * Hello mnavaidd!
 * The endpoint to get the categories and category names are not inside “post”… 
   are inside “taxonomies”, like this:
 * your-url.com/wp-json/taxonomies/category/terms
 * Then, to get post of that category:
 * your-url.com/wp-json/posts?filter[category_name]=CategoryName (replace CategoryName
   with the actual slug of that category).
 * The specific category name is inside this tree:
 * terms > category (this one is an array) > name (this is the actual category name)
 * Inside category, you can reach the meta info. Then: meta > links > self
 * your-url.com/wp-json/taxonomies/category/terms/7
 * The problem is that you’re taking “category” as an object and, remember, is an
   array. Post could/can have more than 1 category.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP REST API (WP API)] Retrieving mp3 media items from media library](https://wordpress.org/support/topic/retrieving-mp3-media-items-from-media-library/)
 *  [mkiisoft](https://wordpress.org/support/users/mkiisoft/)
 * (@mkiisoft)
 * [11 years ago](https://wordpress.org/support/topic/retrieving-mp3-media-items-from-media-library/#post-6327036)
 * Hello drspencer! Don’t know if that’s possible… or easily possible.
 * Try this:
 * your-url.com/wp-json/media?filter[s]=mp3 or your-url.com/wp-json/media?filter[
   s]=%2Emp3
 * Also, a really advance search ‘ll need more plugins:
 * Step 1: Install WordPress 4.3 beta
    Step 2: Install WP REST API (WP API) v2 Step
   3: Install SearchWP plugin 2.6+ Step 4: Install SearchWP API plugin
 * After ALL that you should have an amazing query filter power… a few examples 
   are here:
 * [https://calderawp.com/doc/searchwp-api-queries/](https://calderawp.com/doc/searchwp-api-queries/)
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP REST API (WP API)] How to write custom(my own) api in WP REST API Plugin?](https://wordpress.org/support/topic/how-to-write-custommy-own-api-in-wp-rest-api-plugin/)
 *  [mkiisoft](https://wordpress.org/support/users/mkiisoft/)
 * (@mkiisoft)
 * [11 years ago](https://wordpress.org/support/topic/how-to-write-custommy-own-api-in-wp-rest-api-plugin/#post-6356724)
 * Hello prajaktadhanke! To get the content of an specific user, you must know the
   user ID. To get all users and users ID, use this endpoint: your-url-goes-here.
   com/wp-json/users
 * One you know the user ID, simple use this:
 * your-url-goes-here.com/wp-json/posts?filter[author]=1
 * ID: 1 normally is the “admin”. If “co-author josh” (for example) is ID: 2… then,
   use filter[author]=2 at the end of your URL.
 * Ones you have that, install “WP REST API Filter Fields” plugin and add this endpoint:&
   fields=ID,title,content,featured_image,date
 * That will only shows you those values with a clean small json response.
 * PS: Please, replace “your-url-goes-here.com” with your actual URL

Viewing 15 replies - 1 through 15 (of 24 total)

1 [2](https://wordpress.org/support/users/mkiisoft/replies/page/2/?output_format=md)
[→](https://wordpress.org/support/users/mkiisoft/replies/page/2/?output_format=md)