記載された情報が古くなっている可能性がございますので十分ご注意ください。
WordPressは「XMLRPC」という機能を使って、外部からリモート投稿することができます。
[設定]-[投稿設定]の下記にチェックを入れると有効になります。

それでは、「CodeIgniter」でプログラムを書いてみます。
※下記コードは「CodeIgniter」のある程度の知識が必要です。
$this->load->library('xmlrpc');
$this->xmlrpc->server('http://WordPressのURL/xmlrpc.php');
//事前に認証確認をして「Blog_id」を取得する
$this->xmlrpc->method('wp.getUsersBlogs');
$this->xmlrpc->request(array('ユーザ名', 'パスワード'));
if ( ! $this->xmlrpc->send_request())
{
echo $this->xmlrpc->display_error();
} else {
echo "WordPress認証OK";
$blog_info = $this->xmlrpc->display_response();
}
//記事の投稿
$this->xmlrpc->method('metaWeblog.newPost');
$thePost = array(
array(
'title' => array('記事タイトル','string'),
'description' => array('記事本文','string'),
'categories' => array(array('カテゴリ'),'struct'),
'post_type' => array('post','string'),
), 'struct');
$post_data = array(
$blog_info[0]['blogid'], //取得した「Blog_id」
'ユーザ名',
'パスワード',
$thePost,
false //下書き
);
$this->xmlrpc->request($post_data);
if ( ! $this->xmlrpc->send_request())
{
echo $this->xmlrpc->display_error();
} else {
$post_id = $this->xmlrpc->display_response();
echo "投稿OK:[$post_id]";
}
こんな感じでWordPressへ投稿ができました。
カスタムフィールドやキーワード設定など、その他の投稿設定も「$thePost」へ項目を追加することで対応できるようです。
詳しくは下記をご覧ください。
[WordPress] XML-RPC MetaWeblog API









