# How to Automate WordPress Blog Publishing using the API

- Tool: API Automations
- Difficulty: Beginner
- Fix time: 15-30 minutes
- Compatibility: WordPress 5.6+ (Application Passwords core feature); HTTPS required; Editor or Administrator role needed to publish directly
- Last updated: May 2026

## TL;DR

Automate WordPress blog publishing by uploading a featured image with POST /wp-json/wp/v2/media (multipart), then creating the post with POST /wp-json/wp/v2/posts using HTTP Basic Auth with Application Passwords over HTTPS. The key constraint: creating with status 'publish' requires the Editor or Administrator role — Author-level Application Passwords can only create drafts. WordPress core has no rate limits, but managed hosts (WP Engine, Kinsta) enforce WAF throttles.

## Best practices

- Upload the featured image before creating the post — you need the media ID first
- Fetch and cache category and tag ID maps at script startup rather than per-post
- Test with status: 'draft' before running in production with status: 'publish'
- The X-WP-Total and X-WP-TotalPages response headers tell you how many items exist — use them for pagination rather than guessing
- Use an Editor-level Application Password for publishing — Author accounts silently downgrade to 'draft' even if you request 'publish'
- Send HTML content, not Markdown — WordPress stores and renders HTML natively
- Add 500ms delays between posts when publishing in bulk to avoid managed host WAF throttles

## Frequently asked questions

### Why does my post get created as a draft even though I set status: 'publish'?

This happens when the Application Password belongs to an Author-level user. Authors have create_posts capability but not publish_posts capability. WordPress silently downgrades the status to 'pending' or 'draft' instead of returning an error. Use an Application Password from an Editor or Administrator account to publish directly.

### How do I create new categories or tags via the API?

Send POST /wp-json/wp/v2/categories with {"name": "My Category"} and POST /wp-json/wp/v2/tags with {"name": "My Tag"}. Both require the manage_categories capability (Editor+). The response includes the created ID to use in subsequent post creation calls.

### Can I schedule a post for future publishing?

Yes. Set status to 'future' and include a 'date' field with an ISO 8601 datetime in the site's timezone: {"status": "future", "date": "2026-06-01T09:00:00"}. WordPress will publish it at that time automatically.

### Is the WordPress REST API free?

The WordPress REST API is built into WordPress core and is free to use. Self-hosted WordPress has no API usage costs. WordPress.com (the hosted service) has its own REST API with rate limits that are not publicly documented, but Automattic does not charge per-API-call fees.

### What happens when I hit the rate limit on a managed host?

Managed WordPress hosts (WP Engine, Kinsta, SiteGround) return HTTP 429 when their WAF throttles your requests. The exact limits are not published. Implement exponential backoff starting at 2 seconds and add 500ms delays between sequential publishing calls to avoid triggering the throttle.

### How do I update an existing post instead of creating a new one?

Send POST /wp-json/wp/v2/posts/{id} to replace a post, or PATCH /wp-json/wp/v2/posts/{id} for a partial update. You need the post ID, which you can find by searching with GET /wp-json/wp/v2/posts?search=post+title&status=any.

### Do Application Passwords work with 2FA enabled on my WordPress account?

Yes. Application Passwords bypass 2FA by design — they are REST API credentials only, separate from your login flow. 2FA protects your wp-admin login, but Application Passwords authenticate API calls directly without going through the 2FA challenge.

### Can RapidDev build a custom WordPress publishing automation?

Yes. RapidDev has built 600+ apps including content pipeline automations that connect Notion, Google Sheets, and AI content generators to WordPress publishing workflows. We can build a fully managed solution tailored to your content calendar. Visit rapidevelopers.com for a free consultation.

---

Source: https://www.rapidevelopers.com/api-automations/how-to-automate-wordpress-blog-publishing-using-the-api
© RapidDev — https://www.rapidevelopers.com/api-automations/how-to-automate-wordpress-blog-publishing-using-the-api
