Skip to content
This repository has been archived by the owner on Feb 1, 2019. It is now read-only.

Fix select field type output bug. #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion json-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: WordPress JSON API
Plugin URI: https://github.com/cfpb/wp-json-api
Description: A RESTful API for WordPress
Version: 1.1.5
Version: 1.1.6
Author: Dan Phiffer, Greg Boone
*/

Expand Down
9 changes: 2 additions & 7 deletions models/post.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,17 +272,12 @@ function set_custom_fields_value() {
$keys = explode(',', $json_api->query->custom_fields);
}
foreach ($wp_custom_fields as $key => $value) {
if ( sizeof( $wp_custom_fields[$key] ) > 1 ) {
$field = $wp_custom_fields[$key];
} else {
$field = $wp_custom_fields[$key][0];
}
if ($json_api->query->custom_fields) {
if (in_array($key, $keys)) {
$this->custom_fields->$key = maybe_unserialize( $field );
$this->custom_fields->$key = get_post_meta($this->id, $key, $single = true);
}
} else if (substr($key, 0, 1) != '_') {
$this->custom_fields->$key = maybe_unserialize( $field );
$this->custom_fields->$key = get_post_meta($this->id, $key, $single = true);
}
}
} else {
Expand Down