Open source · .NET 10

WordPressSharp

An async .NET client for WordPress’s REST API. Work with core resources through typed methods, or call plugin and custom routes directly.

A modern WordPress client for .NET

WordPressSharp 2.x replaces the retired XML-RPC implementation with an asynchronous client for the WordPress REST API. It targets .NET 10 and needs no WordPress-specific dependency.

Typed core endpoints

Posts, pages, media, comments, users, categories, tags, themes, plugins, and more.

Custom routes too

Discover a site's API routes and call plugin or custom endpoints with JSON.

Async and cancellable

Network operations support async/await, cancellation tokens, and caller-managed HttpClient.

Install

dotnet add package WordPressSharp --version 2.0.0

Get started

using WordPressSharp;

using var client = new WordPressClient(new WordPressClientOptions
{
    SiteUri = new Uri("https://example.com/"),
    Username = "api-user",
    ApplicationPassword = Environment.GetEnvironmentVariable("WORDPRESS_APP_PASSWORD")!
});

var posts = await client.GetPostsAsync(new WordPressListOptions
{
    PerPage = 10,
    Status = "publish"
});

Application Password authentication is sent only over HTTPS to the configured site's host. Keep credentials in a secret store or environment variable.

Learn more

See the README for endpoint examples, custom authentication, build instructions, and publishing details. WordPressSharp is maintained by Andy Brudtkuhl.