【发布时间】:2012-09-19 04:33:48
【问题描述】:
我正在尝试使用 node-wordpress 库运行 wordpress RPC 方法,但由于根本没有文档,我不确定运行它的正确方法是什么。
如果您有机会使用它,能否举一些例子?
【问题讨论】:
我正在尝试使用 node-wordpress 库运行 wordpress RPC 方法,但由于根本没有文档,我不确定运行它的正确方法是什么。
如果您有机会使用它,能否举一些例子?
【问题讨论】:
我已经通过阅读模块本身来完成它。
首先你启动客户端:
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
希望对您有所帮助。
【讨论】: