I’ve read the similar questions but no joy. I want to add tags when creating a new post using XMLRPC Api.
I am able to send all other parameters perfectly, but tags will not add. Thank you.
$params = array('post_type' => 'post',
'post_status' => 'publish',
'post_title' => 'I like coffee',
'post_content' => 'some more content here',
'post_name' => 'complete name',
'post_category' => array('2', '1'),
'tags_input' => array('lemon', 'pear')
);
SOLUTION: THIS WORKS
$params = array('post_type' => 'post',
'post_status' => 'publish',
'post_title' => 'I like coffee',
'post_content' => 'some more content here',
'post_name' => 'complete name',
'post_category' => array('2', '1'),
'terms' => array( 'category' => array('1', '2'),
'post_tag' => array('4', '3')
)
);
1 comment