我正在使用以下代码发布到 wordpress
<?php
require("class-IXR.php");
$client = new IXR_Client('http://domain.com/xmlrpc.php');
$USER = 'user';
$PASS = 'pass';
$content['title'] = 'Test title';
$content['categories'] = array("games");
$content['description'] = '<p>Lorem ipsum dolor sit amet</p>';
$content['custom_fields'] = array( array('key' => 'my_custom_fied','value'=>'yes') );
$content['mt_keywords'] = array('foo','bar');
if (!$client->query('metaWeblog.newPost','', $USER,$PASS, $content, true))
{
die( 'Error while creating a new post' . $client->getErrorCode() ." : ". $client->getErrorMessage());
}
$ID = $client->getResponse();
if($ID)
{
echo 'Post published with ID:#'.$ID;
}
?>
我怎样才能避免发布重复的标题。例如,如果我已经有标题的帖子Test it
。当我尝试发布另一个带有标题的帖子时,Test it
它不应该发布。
Ps:我的博客里有1000个帖子。