WordPress is a fast and highly effective platform for hosting a REST API for a variety of use cases, especially if your API endpoints serve content like images or filterable, categorized blocks of text. This step-by-step guide demonstrates how to implement a production-ready REST API in only a few hours, and with no custom coding required.


Why build a REST API with WordPress?” great question! Even though my own vanity and technology stack preferences tend towards, well, any other option besides WordPress, I nonetheless recognize that it is a pragmatic and robust solution for many use cases. A WordPress REST API implementation is best explained by way of example, and as it happens, I implemented a REST API for my ReactJS-based personal web site in mid-summer of 2020 and I’m quite satisfied with it in terms of usability, customizability, performance, reliability, cost, and maintainability. Incidentally, I’ve since come to realize that a WordPress-based REST API is also horizontally scalable, even more so than a typical WordPress web site.

The WordPress build itself is surprisingly simple. No custom PHP programming is required. You can refer to this blog article, “Step by Step Guide to Setup WordPress on Amazon EC2 (AWS) Linux Instance“, for step-by-step instructions on creating a basic WordPress site on Ubuntu Linux. Since version 5.0, WordPress includes a full-featured REST API with a complete set of endpoints for managing WordPress posts, pages and media. However, you can greatly enhance these built-in capabilities with a pair of free WordPress plugins: Advanced Custom Fields, (or Advanced Custom Fields PRO if you use an Avada Theme) and ACF to REST API. This in a nutshell is the basic installation that is needed in order to implement full-featured REST API basic entity-relationships, but in the interest of being thorough, following is the complete set of WordPress Plugins that I am using on the site.