Saving custom post types post_meta over REST-API fails

I try to save with wp-json my custom post types meta data but does not works in my case

I create my custom post type with jjgrainger’s class as it follows

$arguments = array(
‘public’ => true,
‘show_in_rest’ => true,
);

$survey = new PostType(‘survey’, $arguments);
$survey->register();

register_meta( ‘survey’, ‘survey_data’, array(
‘show_in_rest’ => true,
‘single’ => true
) );

return $survey;

but when I save the following structure

post: {
title: “Title”,
content: “some content”,
status: ‘publish’,
id: null,
survey_data: null,
meta: {
survey_data: [{‘some’: ‘asdasd’}, {‘some’:’ssdfs’}]
}
},

the post will be created but not the meta data

Read more here:: Saving custom post types post_meta over REST-API fails

Leave a Reply

Your email address will not be published. Required fields are marked *