开发者

Publishing posts in WordPress using jwordpress

开发者 https://www.devze.com 2023-03-08 18:37 出处:网络
I am using jwordpress-0.4.jar to post to a WordPress installation. T开发者_Go百科he code I am using is:

I am using jwordpress-0.4.jar to post to a WordPress installation.

T开发者_Go百科he code I am using is:

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);

This worked well before, but now when I go to publish it goes to its scheduling mode, I have tried:

recentPost.setPost_status("Published");

and

wp.newPost(recentPost, true);

But the post is still no published:


Try it with different wordpress version. I have used the jwordpress-0.4.jar and it was working for me fine, don't remember which version if wordpress I was running it on though.


In your code you put:

recentPost.setPost_status("Published");

But use this instead:

recentPost.setPost_status("Publish");
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号