以下のコードを使用してワードプレスに投稿しています
<?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
れません。
追伸:ブログに1000件の投稿があります。