我正在尝试连接到wordpress安装,以便创建特定类型的帖子。我使用的代码是:
Include(\'../wp-includes/class-IXR.php\');
$client = new IXR_Client(\'http://www.example.com/xmlrpc.php\');
$content = array(
\'title\' => \'Test\',
\'description\' => \'content\',
\'mt_allow_comments\' => 0, // 1 to allow comments
\'mt_allow_pings\' => 0, // 1 to allow trackbacks
\'post_type\' => \'question\',
\'mt_keywords\' => \'test\'
);
if (!$client->query(\'metaWeblog.newPost\',\'\', \'admin\',\'pass\', $content, publish)) {
die(\'An error occurred - \'.$client->getErrorCode().":".$client->getErrorMessage());
}
echo $client->getResponse(); //with Wordpress, will report the ID of the new post
当我尝试此代码时,出现以下错误:
An error occurred - 401:Invalid post type
我是肯定的
question
是有效的帖子类型,因此我不确定如何从这里开始。
任何帮助都将不胜感激。谢谢