Trying to pick the right API for your WordPress automation or headless site?
Choosing the wrong interface can leave you fighting bloated JSON payloads, plugin lock-in, or brute-force security alerts.
The good news is that each of WordPress’s three API options has a clear winner depending on your workload. In this comparison, we break down the WordPress REST API, WPGraphQL, and XML-RPC so you can pick the right one for production.
Executive Summary
- WordPress REST API (Best for Publishing Automation): Built into WordPress core since version 4.7, ideal for Python scripts, media uploads, and standard CRUD operations.
- WPGraphQL (Best for Headless Frontends): A free plugin that lets Next.js or Astro apps fetch exact nested data in a single GraphQL query.
- XML-RPC (Legacy Only): An older XML-based protocol that ships with WordPress for backward compatibility and should usually be disabled on modern sites.
- Caching Matters: Standard HTTP
GETroutes in the REST API are easy to cache at the CDN edge, whilePOST-based GraphQL queries often need persisted queries for edge caching.
Table of Contents
- Side-by-Side Comparison Table
- 1. WordPress REST API: The Built-In Automation Standard
- 2. WPGraphQL: Built for Complex Headless Frontends
- 3. XML-RPC: Legacy Protocol to Disable
- Code Comparison: Fetching a Post Title and Author
- Which One Should You Choose?
- Frequently Asked Questions
- You May Also Like
- Primary Sources and References
Side-by-Side Comparison Table
Here is how the three WordPress APIs compare across setup, performance, security, and real-world use cases.
| Feature | WordPress REST API | WPGraphQL | XML-RPC |
|---|---|---|---|
| Built Into Core | Yes (since WordPress 4.7) | No (requires WPGraphQL plugin) | Yes (legacy xmlrpc.php) |
| Data Format | JSON over HTTP | JSON over GraphQL | XML over HTTP POST |
| Media Upload Support | Native binary upload (/media) | Limited (often paired with REST) | Base64 XML payloads |
| Payload Size Control | Fixed schema (or _fields param) | Exact fields requested by client | Verbose XML responses |
| CDN Edge Caching | Easy (GET requests) | Requires GET persisted queries | Not cache-friendly (POST only) |
| Security Reputation | Strong with Application Passwords | Strong when introspection is locked | Frequent brute-force and DDoS target |
| Best Use Case | Publishing scripts, webhooks, SaaS | Headless Next.js / React sites | Legacy desktop clients only |

1. WordPress REST API: The Built-In Automation Standard
The WordPress REST API exposes posts, pages, media, categories, and custom post types under /wp-json/wp/v2/. Because it ships inside WordPress core, you do not need to install or maintain an extra plugin.
At TeckScaler, we use the REST API for all automated content publishing. It handles binary image uploads to /wp-json/wp/v2/media cleanly and pairs naturally with WordPress Application Passwords over HTTPS.
Its main drawback appears when building deeply nested frontends. If you need a post, its author details, its featured image, and three related posts, a naive REST setup may require multiple HTTP requests unless you use _embed.
Pro Tip: Use the
_fieldsquery parameter (for example,? _fields=id,title,slug) on RESTGETrequests to trim response sizes by up to 80%.
2. WPGraphQL: Built for Complex Headless Frontends
WPGraphQL is a widely used open-source WordPress plugin that adds a single /graphql endpoint to your site. Instead of hitting separate routes for posts, categories, and authors, your frontend sends one query asking for the exact fields it needs.
This makes WPGraphQL a strong fit for headless Next.js, Gatsby, or mobile apps with complex custom post types and Advanced Custom Fields (ACF). You avoid over-fetching unused metadata and get a strongly typed schema out of the box.
However, WPGraphQL is not ideal for simple publishing automation. Uploading binary images via GraphQL mutations is awkward compared to a direct REST POST to /wp-json/wp/v2/media. Most headless teams still keep the REST API active for media uploads and admin webhooks.
3. XML-RPC: Legacy Protocol to Disable
XML-RPC predates the REST API by more than a decade. It accepts XML-formatted POST requests at /xmlrpc.php and was originally built for early desktop blogging tools and trackbacks.
Today, XML-RPC is mostly known as an attack surface. Bots target xmlrpc.php with system.multicall requests to test hundreds of username and password combinations in a single HTTP call.
Unless you rely on an older third-party integration or specific Jetpack features that require xmlrpc.php, block it at your firewall or Cloudflare WAF. Both the REST API and WPGraphQL are faster, cleaner, and safer.
Code Comparison: Fetching a Post Title and Author
To see the practical difference, compare how you request a post title and author name using REST versus GraphQL.
REST API Request (GET)
curl -s "https://example.com/wp-json/wp/v2/posts?per_page=1&_embed&_fields=id,title,_links"WPGraphQL Request (POST)
query LatestPost {
posts(first: 1) {
nodes {
databaseId
title
author {
node {
name
}
}
}
}
}Notice how REST uses URL query parameters on a GET endpoint, which any CDN can cache automatically. WPGraphQL gives you exact nested control over author.node.name without extra _links noise.
Note: On high-traffic headless sites using WPGraphQL, enable GraphQL Smart Cache or persisted
GETqueries so LiteSpeed or Cloudflare can cache responses at the edge.
Which One Should You Choose?
Follow this simple rule of thumb for production projects:
- Choose the WordPress REST API if you are writing Python publishing scripts, syncing content from Markdown, uploading images, or integrating with WordPress SEO plugins like Rank Math.
- Choose WPGraphQL if you are building a custom decoupled frontend in Next.js or React that renders deeply nested custom fields across many post types.
- Avoid XML-RPC on all new projects, and block
xmlrpc.phpin your server or WAF rules if nothing depends on it.
Frequently Asked Questions
Can I run the WordPress REST API and WPGraphQL on the same site?
Yes. WPGraphQL runs alongside the built-in WordPress REST API without conflicts. Many headless teams use WPGraphQL for frontend rendering and the REST API for backend content and media automation.
Is WPGraphQL faster than the WordPress REST API?
WPGraphQL can reduce network round-trips when fetching nested relationships in one call. For simple single-post fetches or cached GET endpoints, the REST API is often just as fast or faster because it requires less query parsing overhead.
Does disabling XML-RPC break the WordPress REST API?
No. Blocking xmlrpc.php has zero effect on /wp-json/wp/v2/ or WordPress Application Passwords.
Which API works best with Python and Application Passwords?
The WordPress REST API works best with Python. You can authenticate with standard HTTP Basic Auth headers and send clean JSON payloads using the requests library without GraphQL client dependencies.
You May Also Like
We hope this comparison helped you choose the right WordPress API for your production stack. Written by the TeckScaler Editorial Engineering Team. Explore the rest of our WordPress automation series:
- Automate WordPress Publishing via REST API: Complete Guide.
- How to Post Gutenberg Blocks with Python and WP REST API.
- Fix 401 and 403 WordPress REST API Errors on LiteSpeed.
Primary Sources and References
- WordPress REST API Handbook (Official WordPress Developer Resources)
- WPGraphQL Introduction and Architecture (Official WPGraphQL Documentation)
- WordPress XML-RPC Support Overview (Official WordPress Developer Resources)



