Skip to content

Instantly share code, notes, and snippets.

@abrudtkuhl abrudtkuhl/CreatePost.cs
Last active Aug 18, 2018

What would you like to do?
Using WordPressSharp To Publish A Post
// create a new Post in WordPress
var post = new Post
PostType = "post", // "post" or "page"
Title = "Using WordPressSharp",
Content = "WordPressSharp is a C# utility for interfacing with the WordPress XML-RPC API",
PublishDateTime = DateTime.Now,
Status = "publish" // "draft" or "publish"
var customFields = new[]
new CustomField
Key= "my_custom_field", Value="My Custom Value"
new CustomField
Key = "another_custom_field", Value = "Yet another"
post.CustomFields = customFields;
using (var client = new WordPressClient(new WordPressSiteConfig {
BaseUrl = "",
BlogId = 1,
Username = "admin",
Password = "password"
var id = client.NewPost(post);

This comment has been minimized.

Copy link

commented Aug 17, 2015

Hi friend!
How can I add tags in a new post ?


This comment has been minimized.

Copy link

commented Aug 18, 2018

what about advance custom field repeater fields? it's a Multi-dimensional array.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.