“Unlock the Future of Web Development: Discover the Hidden Powers of Headless WordPress!”
So how do you know if your project would benefit from a Headless WordPress setup? And how exactly do you connect all the pieces? Read on:
Decoupled, but not disconnected: What is Headless WordPress?
Before we dig deeper, let’s look at how WordPress typically handles a request from a user:
In a traditional environment, WordPress handles the entire stack—content management and the presentation layer.
At a high level, a typical request from a user may look like this:
- A user requests a page on your website.
- The request goes to WordPress via NGINX, where we load
wp-config
, settings, plugins, and the active theme. - The requested page/post is determined, and data is queried from the database.
- From a template hierarchy, the specific templates are determined (
page.php
,single.php
, etc.). - The template loads the header, content, footer, and other necessary parts.
- WordPress outputs the HTML and sends it to the browser, where it is rendered for the user to see and interact with.
There are many similarities between a Headless site and a regular site. However, for a Headless site, your frontend needs to relay requests to WordPress’s REST API (or GraphQL) endpoint, and it is up to the frontend to assemble and serve the generated HTML.