使用jwordpress在WordPress中发布帖子

时间:2011-05-28 06:14:21

标签: java wordpress posting

我正在使用 jwordpress-0.4.jar 发布到WordPress安装。

我使用的代码是:

Wordpress wp = new Wordpress(username, password, xmlRpcUrl);
Page recentPost = new Page();
recentPost.setPost_status("Published");
recentPost.setDescription("<ul>" + desc + "</ul>");
recentPost.setCategories(cat);
String pageID=recentPost.getPage_id();
String result = wp.newPost(recentPost, true);

这之前运作良好,但现在当我去发布它进入其调度模式时, 我试过了:

  

recentPost.setPost_status( “发布时间”);

  

wp.newPost(recentPost,true);

但这篇文章仍未发表:

2 个答案:

答案 0 :(得分:0)

尝试使用不同的wordpress版本。我使用了jwordpress-0.4.jar,它对我很好,不记得哪个版本,如果wordpress我运行它虽然。

答案 1 :(得分:0)

在您的代码中添加:

recentPost.setPost_status("Published");

但请改用:

recentPost.setPost_status("Publish");