I have a stand alone app done in PHP which creates a new post on my remote wordpress site. Everything works with exception of adding meta data / custom fields to the post at the time when I create it. Looking at the end point for posts I see meta is an object and am trying to pass a key->value array. Example of what I’m posting

$post=array('title' => 'Test Title',
     'content' => 'I like short test posts.',
     'author' => 1,
     'excerpt' => 'This could be longer than the actual post',
     'categories' => array(2,3,4,5),
     'meta' => array('MyMetaKey' => 'MyMetaValue')
     );

Checking the post on the site everything is in there except for the meta data/custom fields. Not sure the post array is correct.

Read more here: Create new post with meta data using WordPress API


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: