Title: [Plugin: JSON API] fetch all custom_fields by JSON-API
Last modified: August 20, 2016

---

# [Plugin: JSON API] fetch all custom_fields by JSON-API

 *  [kassisbassem](https://wordpress.org/support/users/kassisbassem/)
 * (@kassisbassem)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-json-api-fetch-all-custom_fields-by-json-api/)
 * I want to fetch all custom_fields by JSON-API
    I have done some changes to the
   Post.php ` function set_custom_fields_value() { global $json_api; if ($json_api-
   >include_value(‘custom_fields’) && $json_api->query->custom_fields) { $keys =
   explode(‘,’, $json_api->query->custom_fields); if (in_array(“all”, $keys)) { 
   $keys=get_meta_keys(); } $wp_custom_fields = get_post_custom($this->id); $this-
   >custom_fields = new stdClass(); foreach ($keys as $key) { if (isset($wp_custom_fields[
   $key])) { $this->custom_fields->$key = $wp_custom_fields[$key]; } } } else { 
   unset($this->custom_fields); } }
 * you have just to add this line custom_fields=all and everything works
    is it 
   possible to include this in the next release ?
 * [http://wordpress.org/extend/plugins/json-api/](http://wordpress.org/extend/plugins/json-api/)

The topic ‘[Plugin: JSON API] fetch all custom_fields by JSON-API’ is closed to 
new replies.

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

## Tags

 * [custom_field](https://wordpress.org/support/topic-tag/custom_field/)
 * [json](https://wordpress.org/support/topic-tag/json/)

 * 0 replies
 * 1 participant
 * Last reply from: [kassisbassem](https://wordpress.org/support/users/kassisbassem/)
 * Last activity: [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-json-api-fetch-all-custom_fields-by-json-api/)
 * Status: not resolved