I am using JSON API plugin for wordpress and able to add info to meta boxes (custom fields) to any custom post type but cannot do the same with taxonomies.
The code for meta boxes (custom fields) below:
// For prettier URLs, a map of post_type => (url_param_name => meta_field_name)
$CUSTOM_POST_META_FIELDS = array(
'classifieds' => array(
'price' => 'wpcf-price-with-discount',
'condition' => 'wpcf-condition'
)
);
// Handle metadata
global $CUSTOM_POST_META_FIELDS;
if ($this->id && !empty($CUSTOM_POST_META_FIELDS[$wp_values['post_type']])) {
foreach ($CUSTOM_POST_META_FIELDS[$wp_values['post_type']] as $param => $meta) {
update_post_meta($this->id, $meta, $values[$param]);
}
}
Can you suggest the similar code for adding taxonomies terms please? For example post type 'classifieds' has got taxonomy 'type' and I want to add any terms to it.