When to Use the WordPress REST API – and When Not To

When to Use the WordPress REST API – and When Not To

The WordPress REST API will solve lots of problems and have more uses than we’ve even begun to explore just yet. But it’s no magic bullet and there will be times when you’re better off not using it at all.

There still isn’t a huge number of developers or agencies using the REST API for live sites, partly because the API is still under development and partly because it’s a new technology that people still need to learn and experiment with.

But there will be times – even once the API is well-established – when it really isn’t worth using.

In this post, I’m going to identify the circumstances and projects for which you might want to use the REST API, and those for which you won’t. I’ll cover this in three areas:

  • Platforms and technologies
  • Applications
  • Team and circumstances

Let’s start with platforms and technologies.

The WP REST API is the hottest thing in WordPress circles right now: but is it always the best solution?
The WP REST API is the hottest thing in WordPress circles right now: but is it always the best solution?

Platforms and Technologies

The WP-REST API is particularly useful when you want to link WordPress with APIs provided by other platforms, or you’re using it as the basis for an application written using a language other than PHP. There are some examples of real world sites already doing this.

If you’re building a web app, the REST API gives you the flexibility to use whichever language is most appropriate (normally JavaScript) to do that. Building your app in JavaScript means you can create screens that work in the same way as an offline application, with complex interactions, use of data and no need to keep moving between screens. Examples of web apps that you may have used include various Google apps such as Google Calendar, Gmail, and the company’s document creation apps. If you wanted to create something similar using data stored by WordPress, then the REST API makes it possible.

Alternatively, if you want to take the data you’ve got stored in a WordPress database and use it to power another kind of app such as a mobile app, again the REST API makes it possible. So, for example, if you have an eCommerce site and you want to provide your customers with an app they can use to buy from you on their phones, the REST API could be used to link the two.

Plenty of WordPress sites currently interact with other APIs, displaying data provided by social media platforms such as Twitter or Facebook or providing maps on events sites by linking to Google Maps, for example. But this is a one-way relationship and the data from the external API is grabbed by your site and displayed there without interacting with your WordPress data. If you need your data to work harder, and if you want the data in your WordPress database to truly interact with data from another API, then the REST API is what you need to make this happen. If you just want to display data from outside WordPress you don’t need the REST API, but if you want interaction between the data from your site and the external source, then it’s a good idea to use the REST API.

Wired website
Wired uses the REST API to link to an external app

A site that uses the REST API to link to an external API is technology new sites Wired, which uses it to send content to the Apple News app, converting posts created in their WordPress site to markdown and then outputting it using the Apple native format for its mobile app.

WordPress sites are currently built using PHP, with HTML and CSS added. If your site is built using a different language, or you have a site or app already created in another language which you want to link to WordPress, then the REST API will make that possible.

So if you’re adding WordPress data to an existing site built using JavaScript or Python, for example, you’ll need to use the REST API. But if you just need to work in PHP, then you won’t need the added complexity of the REST API.


So if you’re working with external platforms and technologies, the REST API is probably the way to go. But there’s another way to look at it, which is according to the type of application you’re building. In other words, what your site or app is there to do (or for your visitors to do).

If you’re creating a simple blog, then you don’t need to concern yourself with the REST API. WordPress will continue to provide everything you need for blogging using PHP, either by installing third party themes and plugins or by building your own.

If your site is an eCommerce site, then you may or may not need the REST API. If all you need to do is use your site to sell goods or services from that one place, then the REST API won’t add anything. But there are a few circumstances when the REST API could make your store more powerful and help you reach out to a wider audience of buyers:

  • If you want to provide your customers with an app-like experience, either via a web app or a mobile app (or both), the REST API will make it possible to develop a JavaScript-based e-commerce application on top of your WordPress data, or to link to a mobile app.
  • If your audience is using other sites such as eBay or Facebook for shopping, then the REST API could make it possible for you to link your online store to your store on those platforms. This way you can avoid duplicate stores, with associated efficiency when it comes to order management and stock-keeping. I’m not aware of any stores that do this yet (if you are, let me know in the comments below), but theoretically this could be an exciting use of the REST API.
Custom admin dashboard
It’s possible to build a dashboard that looks quite unique without using the REST API – this is a dashboard my team created from scratch

If you want to customize or rebuild the admin interface for your users or clients, whether you need the REST API will depend on the degree of customization you need.

WordPress already provides lots of hooks you can use to drastically alter the admin interface, which is something I’ve done for clients, creating a completely new dashboard and custom admin screens.

However if you want to build an app-like admin interface, which is built from the ground up instead of being based on the existing admin screens, then you’ll need to use the REST API to do this.

Automattic’s Calypso admin platform has done this using the WordPress.com REST API, which is in the process of being merged with the REST API for self-hosted sites.

Calypso admin screens
Calypso is an example of a single page application

The REST API will make it possible for you to build a single page application (or SPA) using WordPress. Instead of a standard site with multiple pages (each their own URL), this is a one-page site that updates using JavaScript when you click an internal link or display additional content. WordPress already uses AJAX in the admin screens (for example in the Customizer and the Widgets screens), meaning changes are implemented without the page refreshing.

But a SPA like Calypso takes this further, giving users and app-like experience that’s quite different from a standard WordPress site. There’s no reason you couldn’t use WordPress and the REST API to power a SPA on the front end of your site.

Single page applications have their downsides though; if your content is delivered using JavaScript, then that content won’t be part of the page’s markup when it’s first opened and so it won’t be picked up by search engines. If SEO is a priority for you (and let’s face it, who doesn’t worry about SEO?), then you may need to find a workaround for this, such as rendering at least some of the content in JavaScript on the server so it’s preloaded when the page opens.

If your site is highly reliant on geolocation, then the REST API will make it easier for you to link WordPress data with geographical data from external sources. A few years back a client asked my agency to create a mobile version of a site that served up different content dependent on the location of the person visiting the site: the client was a locksmith and they wanted to make it easy for customers to ring their local office. This is the kind of project I could imagine using the REST API for in future.

Team and Circumstances

Choosing which technologies to use for a web development project isn’t just about the technologies themselves; you also have to factor in the team, the client if there is one, and other circumstances surrounding the project. There will be some circumstances in which using the REST API is more appropriate than others.

wp tavern article on state of REST API
The team working on the REST API isn’t in full agreement on its readiness yet.

The first set of circumstances to consider is the level of development of the REST API itself. Right now it isn’t as stable as you might want it to be for large, high-risk client projects.

It’s still under active development and the way it works is likely to change For example the form of the endpoints currently include the version number of the API, which doesn’t feel very sustainable to me.


The team working on the REST API isn’t even in agreement over its state of readiness right now, so I’d be cautious when considering it for client sites.

If you’re working on a project that needs to be built quickly and/or with a minimal budget, I wouldn’t recommend using the REST API right now, unless you’ve already been using it and are familiar with it. Putting up a website in WordPress with a bespoke theme and a couple of custom plugins can be done in a matter of hours. I don’t know about you, but for me, building a site using the REST API would take significantly longer right now.

bocoup website
Bocoup is a JavaScript agency that has come to WordPress via the WP-REST API

Which links to the consideration of your development team’s (or your own) skills and experience. For some teams that are more experienced with JavaScript, using the REST API will be the easiest and most familiar way to interact with data held by WordPress. But for experienced WordPress or PHP developers, working with themes and plugins will be much easier.

Over time, this will shift and more agencies that have previously specialized in JavaScript and front-end redevelopment will start working with WordPress, and developers accustomed to working PHP will learn more JavaScript. But this is at an early stage, in my experience.

Conclusion: The REST API Works in Some Situations, Not in Others

The REST API is a great tool for use ins specific circumstances, but it won’t necessarily be the best approach for all projects.

This will change over time: as the API becomes more stable and the number of developers with experience using it grows (and also as more applications for it are explored), then the number of times when it’s an appropriate solution will increase, but I don’t believe that will ever represent 100% of WordPress website builds. So if you have no idea how to work with the REST API but want to stick with WordPress, don’t worry, you won’t be completely left behind.

Are you using the REST API? Are you thinking about using it for a project and aren’t sure whether to go ahead and do it? If you have a question about the REST API, ask away in the comment below.