Duplicator’s New Migration Service: Move Your Website Without Lifting a Finger
Duplicator’s New Migration Service: Move Your Website Without Lifting a Finger
The REST API turns WordPress into something more than a traditional content management system. It becomes an application framework.
Other programs—whether they’re mobile apps, custom websites, or third-party services—can talk to your WordPress site, request data, and even modify content.
You might think this is purely developer territory. It’s not.
The REST API powers features you probably use every day. The Block Editor? That’s the REST API at work. Every time you add a block or save a post draft, you’re making API calls behind the scenes.
In this post, I’ll break down what the WordPress REST API is, what it actually does, and how to manage it on your site.
Here are the key takeaways:
The WordPress REST API is a built-in interface that lets other systems interact with your WordPress data. Think of it as a bridge between your WordPress site and the outside world.
It ships with WordPress core. You don’t need to install anything extra; it’s already there, waiting to be used.
The API uses JSON (JavaScript Object Notation) as its data format. JSON is a lightweight way to structure data as text. It’s human-readable, which means you can actually look at it and understand what you’re seeing.
A blog post in JSON looks like a neat list of properties: title, content, author, publish date, and so on.
Here’s why this matters: the REST API enables “decoupling.” You can manage your content in WordPress but display that content anywhere. On a mobile app. On a different website. In a digital kiosk. In a custom application your team built from scratch.
Your content lives in one place. But it can appear everywhere.
I like to explain APIs with the restaurant analogy because it actually works.
You’re sitting at a table. You want food. But you can’t just walk into the kitchen and start pulling things out of the fridge. You need an intermediary: that’s the waiter.
You tell the waiter your order (your request). The waiter takes it to the kitchen (the server/database). The kitchen prepares your food. The waiter brings it back to you (the response).
An API is the waiter. It’s the intermediary between an application that wants data and the system that has that data. The API takes requests, communicates with the right systems, and delivers the results in a format the requesting application can understand.
Without the API, applications would need direct access to your database. That would be messy, insecure, and nearly impossible to manage at scale.
REST is a set of architectural rules for building APIs. When an API follows these rules, we call it “RESTful.” The WordPress REST API follows these principles, which is why it has “REST” in its name.
Here are the core concepts:
The server doesn’t remember previous requests. Each request you make has to include everything the server needs to process it. You can’t assume the server knows what you asked for five seconds ago.
This sounds limiting, but it’s actually what makes REST APIs scalable. The server isn’t wasting resources tracking session states for thousands of simultaneous requests.
The client (the app making requests) and the server (your WordPress site) are completely separate. They can be developed independently. Your React app doesn’t care if WordPress updates to version 6.5 or 7.0, as long as the API endpoints stay consistent.
REST APIs use standard HTTP methods like GET, POST, PUT, and DELETE. This standardization makes the API predictable. Developers familiar with REST can pick up the WordPress API quickly because it follows conventions they already know.
These principles aren’t just academic. They make the WordPress REST API reliable, predictable, and easy to work with.
The REST API exposes your WordPress data through URLs called “endpoints.” An endpoint is a specific address where you can request particular data.
For example: /wp-json/wp/v2/posts is the endpoint for your blog posts. Visit that URL on your site, and you’ll get a JSON response containing your posts—titles, content, authors, featured images, everything.
This is the technology powering the Block Editor. When you’re working in Gutenberg, every action you take triggers an API call.
Add a paragraph block? API call. Upload an image? API call. Save your draft? API call. The editor interface is essentially a JavaScript application talking to your WordPress site through the REST API.
The API allows programmatic CRUD operations (Create, Read, Update, and Delete). You can perform all of these actions on your content without ever opening the WordPress dashboard.
As a developer, you could write a script that creates 100 posts in five seconds. Or pull all your posts from the last month and generate a report. Or update every post tagged “outdated” with a disclaimer banner.
The possibilities expand dramatically once you realize WordPress isn’t just a website anymore—it’s a content API that happens to also render websites.
The REST API uses standard HTTP methods to perform different actions. Here’s what each one does:
HTTP Method | Action | Example |
GET | Retrieve data from the server | Fetch a list of all published posts |
POST | Create new data | Add a new blog post or page |
PUT / PATCH | Update existing data | Edit the title of an existing post |
DELETE | Remove data | Delete a comment or media file |
GET requests are read-only. Anyone can make them because they don’t modify your data. Visit a public endpoint in your browser, and you’re making a GET request.
The other methods modify your data. They require authentication. WordPress needs to verify that you have permission to create, update, or delete content before it processes those requests.
The REST API is enabled by default on every WordPress site running version 4.7 or higher. The base path is /wp-json/.
You can test this right now.
Open a new browser tab and navigate to yourdomain.com/wp-json/. You’ll see a JSON response listing all available API routes. It’s not pretty, but it confirms your API is working.
Want to see your posts? Try yourdomain.com/wp-json/wp/v2/posts. You’ll get a JSON array of your published posts, complete with all their metadata.
These public endpoints only show data that’s already publicly visible on your site. But what about actions that modify data, like creating posts, updating pages, or deleting comments?
Those require authentication.
WordPress supports two main authentication methods. Cookie Authentication works for same-domain requests (like the Block Editor).
For external applications, you’ll use Application Passwords. These are 24-character tokens you generate in WordPress, specifically designed for API access. They’re more secure than your actual password because you can revoke them individually without changing your main login credentials.
To generate one, go to Users » Profile. Find the Application Passwords settings and create a new one.
Then, access the REST API with this:
https://mysite.com/wp-json/wp/v2/posts?Authorization=Bearer[Password]
Be sure to replace [Password] with your application password and remove any spaces.
Otherwise, you could use a plugin like JWT Authentication for WP REST API.
Application Passwords are the preferred method. They’re secure, they’re trackable, and they don’t expose your real password to third-party applications.
To test the connection, use this command in a command line:
curl -X GET --user username:password -i http://yoursite.com/wp-json/wp/v2/posts?status=draft
Now that you understand what the REST API is and how it works, let’s look at practical scenarios where it makes sense to use it.
This is when you use WordPress purely as a content management backend. Your visitors never see a WordPress theme. Instead, you build a custom frontend using a JavaScript framework like React, Vue, or Next.js.
That frontend fetches content from the WordPress REST API and renders it however you want. You get WordPress’s excellent content management tools paired with complete design freedom on the frontend.
You can power a native iOS or Android app entirely with content from your WordPress site. The app makes API requests to fetch posts, display images, and show comments.
Your content team manages everything from the WordPress dashboard they already know. The app developers never touch the CMS.
These are web applications that load once and then fetch new content dynamically without full page reloads. The user experience feels faster and more app-like.
Gmail works this way. When you click between emails, the page doesn’t reload—JavaScript fetches the email content via an API. You can build the same experience with WordPress content.
Pull data from WordPress into another platform, or push data from an external service into WordPress.
I’ve seen this used to sync product information between WordPress and inventory management systems. Or to automatically create WordPress posts from data collected in a CRM.
The REST API makes these integrations possible without complex database manipulation.
If you’re running a straightforward blog or business website, you probably don’t need to touch the REST API directly. A traditional WordPress theme handles everything perfectly well.
When initial page load speed is your absolute top priority, a server-rendered theme will often be faster.
Headless setups require JavaScript to fetch and render content, which adds latency. For content-heavy sites where every millisecond of load time matters, traditional WordPress architecture might serve you better.
If a reliable, well-supported plugin already solves your integration problem, use the plugin. Don’t build a custom REST API solution just because you can.
Plugins are maintained, tested, and updated. A custom integration is technical debt you’ll need to manage.
The REST API is powerful. But power without purpose creates unnecessary complexity.
I need to start with a warning: completely disabling the REST API will break the Block Editor. It will likely break several plugins too. If you disable it entirely and then wonder why Gutenberg stopped working, this is why.
The better approach is restriction, not disabling. You can require authentication for all API endpoints. This keeps the Block Editor functional for logged-in users while blocking anonymous access to public endpoints.
If you definitely want to disable REST API, I’d recommend using a plugin like WPCode. It has a built-in code snippet that handles this task for you.
Select the code snippet and auto-insert it into your site. Activate and update the snippet to save your changes.
Even with the REST API enabled and working, you’ll occasionally run into problems. Here are the most common issues I’ve encountered and how to fix them.
This is the error I see most often. You try to access an API endpoint, and WordPress returns a 404 as if the page doesn’t exist.
Nine times out of ten, this is a permalinks issue. WordPress uses .htaccess rules (on Apache servers) to route API requests correctly. Sometimes those rules get corrupted or don’t regenerate properly after a migration or server change.
Go to Settings » Permalinks in your WordPress dashboard. Don’t change anything. Just click Save Changes. WordPress regenerates the rewrite rules, and your API starts working again.
A 401 means “unauthorized”—you didn’t provide credentials. A 403 means “forbidden”—you provided credentials, but they don’t have permission for this action.
Check that your Application Password is entered correctly (no spaces, correct username). Verify that the user account has the right capabilities for what you’re trying to do.
Sometimes a poorly coded plugin or theme interferes with REST API functionality. Use the standard WordPress troubleshooting process: disable all plugins, switch to a default theme (like Twenty Twenty-Four), and test the API.
If it works, reactivate plugins one by one until you find the culprit. Then contact that plugin’s developer or find an alternative.
These appear in your browser’s console when a web application on one domain tries to access the API on a different domain. CORS (Cross-Origin Resource Sharing) is a browser security feature. It blocks these requests by default.
The fix requires adding specific HTTP headers on your WordPress server that explicitly allow requests from your application’s domain. This typically involves editing your .htaccess file or configuring headers in your hosting control panel.
If you’re seeing CORS errors, you’re working with a headless or decoupled setup, and you’ll need server-level access to resolve them.
Yes, the core WordPress API is secure by design. It respects WordPress’s user roles and capabilities system, and public endpoints only expose data that’s already publicly visible on your site.
Yes, in two ways: other applications can connect to your WordPress site’s REST API to read or modify content, or you can use WordPress to connect to third-party APIs like weather services or payment processors.
Use Application Passwords for authentication, enforce HTTPS across your site, and keep WordPress core, themes, and plugins updated. Consider adding a Web Application Firewall (WAF) to filter malicious requests.
The API provides programmatic access to posts, pages, users, taxonomies, media, comments, and settings. Plugins like WooCommerce can add their own custom endpoints for additional functionality.
The WordPress REST API transforms WordPress from a traditional content management system into a true application framework. It’s not just about building websites anymore—it’s about making your content available wherever you need it.
This API is the bridge. It connects WordPress to modern web applications, mobile apps, and third-party services. Understanding how it works helps you make better decisions about your site’s architecture, troubleshoot issues faster, and communicate more effectively with developers.
Your WordPress site’s data is the engine for everything, from the pages your visitors see to the content your REST API serves to other applications. Protecting that data is non-negotiable.
Duplicator Pro gives you a reliable way to back up your entire WordPress installation. Before you start experimenting with a headless setup or connecting a new app, run a full backup. With Duplicator Pro, you can schedule automatic backups and get peace of mind knowing your valuable content is safe.
While you’re here, I think you’ll like these other hand-picked WordPress resources:
Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. We only recommend products that we believe will add value to our readers.