Support Forum
Support › MB REST API › ✅POST meta fields to tags › Reply To: POST meta fields to tags
For anyone following, I have found a fix for the post_tag not having it's meta values saved as well.
In order to fix this one must edit mb-rest-api/class-mb-rest-api.php and change
`register_rest_field(
$this->get_types('taxonomy'),
'meta_box',
array(
'get_callback' => array( $this, 'get_term_meta' ),
'update_callback' => array( $this, 'update_term_meta' ),
)
);`
to
$taxonomies = $this->get_types('taxonomy');
if (in_array("post_tag", $taxonomies)) {
$post_tag_key = array_search('post_tag', $taxonomies);
$taxonomies[$post_tag_key] = 'tag';
}
register_rest_field(
$taxonomies,
'meta_box',
array(
'get_callback' => array( $this, 'get_term_meta' ),
'update_callback' => array( $this, 'update_term_meta' ),
)
);
This is because there appears to be a bug in WordPress rest api itself where it checks for 'tag' instead of 'post_tag' when looking for additional fields.