2012-09-27 34 views

回答

6

我設法通過閱讀模塊本身來完成它。

首先啓動客戶機:

var wp = wordpress.createClient({ 
      "url": 'http://yourwordpressURL', 
      "username": 'user', 
      "password": 'pwd' 
}); 

比增加後,例如,只要下面的調用:

wp.newPost({ 
     title: 'Your title', 
     status: 'publish', //'publish, draft...', 
     content: '<strong>This is the content</strong>', 
     author: 3, // author id 
     terms: {'category': [category_id]} 
    }, 
    function() { 
     console.log(arguments); 
    } 
}); 

所有的WordPress的文檔在http://codex.wordpress.org/XML-RPC_WordPress_API/Posts

希望有所幫助。

+0

這節省了我約3小時的麻煩拍攝。乾杯! – 2013-11-08 01:33:25