When we first wrote about using WordPress as a headless CMS and the WP REST API back in 2017, it was a very big deal for us, JAMstack aficionados.
I mean, a concept like “headless CMS” was only beginning to make noise, and WordPress embracing it was a huge statement.
And it paid.
The web development landscape is ever-changing and the promises of modern frontend techs are materializing.
Every developer and their dog have something to say about WordPress, and it's not always flattering. Far from it. However, even its most avid detractors are forced to take notice of this feature, because it has already transformed the way we use the popular CMS.
This is exactly what I want to do today with this demo of the WordPress REST API in the work.
I'll use WordPress as a backend, and the REST API to feed data into a React app.
More precisely, you’ll learn how to:
- Access the WP REST API from your frontend
- Add a custom post type and expose it to the API
- Build a React app backed by this API
- Handle React Hooks (and create a custom one)
Before we start, let's see what is the REST API for WordPress and why you should care about it.
WordPress itself doesn't need any introduction, but let's take a closer look at the recent WP REST API.
Read the rest of this post & technical tutorial here