我读过类似的问题,但没有快乐。我想在使用XMLRPC Api创建新帖子时添加标签。
我能够完美地发送所有其他参数,但标签不会添加。谢谢。
$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')
);
解决方案:这项工作
$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')
)
);
答案 0 :(得分:0)
$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')
)
);