我使用WordPressSharp lib link但是在文档中我找不到如何发布新文章。默认情况下,新文章将进入草稿。
var post = new Post {
PostType = "post",
Title = "My Awesome Post",
Content = "<p>This is the content</p>",
PublishDateTime = DateTime.Now
};
using (var client = new WordPressClient(new WordPressSiteConfig {
BaseUrl = "http://mywordpress.com",
Username = "admin",
Password = "password",
BlogId = 1
}))
{
var id = Convert.ToInt32(client.NewPost(post));
}
答案 0 :(得分:0)
添加以下行:
Status = "publish";