我正在尝试通过XMLRPC使用WordPress API来提交新帖子。但我无法设置帖子标签(也不能设置类别)。
echo "Adding $term to blog via XMLRPC ...";
$client = new IXR_Client("http://$blog.wordpress.com/xmlrpc.php");
$content = array('title'=>$term,
'description'=>"All about $term",
'category'=>'barvaz,moshe',
'tags'=>'tag1,tag2');
$client->query('metaWeblog.newPost', 0, $username, $password, $content, true);
$rv = $client->getResponse();
print_r($rv);
有什么想法吗?
答案 0 :(得分:3)
$categories[0]="cate1";
$categories[1]="cate2";
$tags[0]="tag1";
$tags[1]="tag2";
...
$content['title'] = $title;
$content['categories'] = $categories;
$content['mt_keywords'] = $tags;
$content['description'] = $description;
更多电子邮件:cn.xiaowen@gmail.com
答案 1 :(得分:1)
您也可以像这样设置自定义字段
$content['custom_fields'] = array(
array('key' => 'Image', 'value' => $img),
array('key' => '_aioseop_keywords', 'value' => $aiokey),
array('key' => '_aioseop_title', 'value' => $title),
);