What is headless WordPress and when should you use it?
WordPress has been the go-to content management system for websites around the world for over a decade now, but just as it evolved from its blogging-only beginnings, it has now entered the headless CMS market, and it seems it’s here to stay.
Headless CMS is a variation of the traditional WordPress architecture, which separates the backend from the frontend, providing a new world of possibilities for developers who want to connect WordPress with dozens of other platforms.
This article explores headless WordPress, its pros and cons, and the cases where using it is more beneficial than the traditional monolithic architecture.
What is a headless CMS?
Headless CMSs separate the frontend and the backend within the same CMS system, integrating them through APIs. This means you manage the content from one platform (backed) but deliver it through a different one (the frontend or presentation layer) using APIs.
A traditional, non-headless CMS has a three-part fundamental structure: a system to store content, a CRUD (Create, Read, Update, Delete) user interface, and various ways of displaying data to visitors (frontend). In this traditional system, the backend combines databases and servers that make the site work, while the frontend is the user-facing part of the website, which users see and interact with when they visit.
In traditional CMSs, the backend and frontend are inseparable, an attribute often called “monolithic” because they form a single structure you can’t separate without compromising its integrity.
Headless CMSs change this formula by providing a backend and an API system to communicate with a separate frontend or presentation layer rather than enmeshing the two inseparably.
What is headless WordPress?
As you can probably imagine by now, headless WordPress is a variant of WordPress’ traditional, monolithic architecture that implements the principles of headless CMSs. This approach uses WordPress for content management, while the presentation layer is a different platform (frontend).
Effectively, WordPress acts as the content management and database interaction hub where developers and content creators can create, edit, and manage content. This content is then exposed to other platforms using WordPress’ REST API or a GraphQL schema, available for consumption to any technology stack or framework developers decide to use for the presentation layer.
This model opens up many interesting possibilities. For example, Next and Angular are popular frontend frameworks. Web apps built using them could retrieve and display content by making API calls to the WordPress content manager. Other potential use cases include Android or iOS apps that consume WordPress’ REST API to display content.
As we can see, the headless architecture allows developers to interact with many other platforms, providing more flexibility for complex web development projects.
What are the pros and cons of headless WordPress?
Pros of headless WordPress
Flexibility and scalability
One of the benefits of headless WordPress is flexibility. By separating the presentation layer from the content management system, developers have more control over the presentation layer design and functionality without worrying about how it affects the WordPress backend.
Additionally, some see headless WordPress as a method to scale and “future-proof” your website. Since future applications will likely apply current API fundamentals, the headless architecture is better suited for adapting to future frameworks and technologies than monolithic WordPress is.
Separating the front and backend means they can operate independently. They can be on different web servers, and developers can optimize each app for their tasks.
Given its popularity, WordPress is a common target for hackers looking to steal confidential information and breach user credentials. Compared to a headless implementation, the traditional WordPress architecture is an “all-in-one” package, which may make a hacker’s job easier by giving them access to the entire WordPress site.
Headless implementations are separated by nature, keeping the backend much more private than in monolithic web apps. Separating the front and backend also means that if one end is compromised, that security breach won’t necessarily affect the other end. In some cases, the frontend may lose access to content if WordPress’ backend is compromised, but the backend will not necessarily be affected if a frontend app is compromised.
Content management for multiple channels
Because the frontend doesn’t confine developers to WordPress’ environment, a headless implementation can provide content for multiple channels, such as mobile apps, single-page websites, IOT gadgets, and social media.
Cons of headless WordPress
More maintenance duties
The headless approach implies you’re running two instances, the WordPress backend and a separate frontend application. Interacting with more platforms means more maintenance duties, which is especially critical if managing security patches for either or both.
Some frontend libraries have a steep learning curve
If it’s your first project using headless WordPress and you’ve only used HTML and CSS for templating, you may have to go through a steep learning curve before effectively implementing a frontend library. You may need to hire a dedicated frontend developer for the team to bridge the gap.
WordPress’s REST API can be slow
If you don’t optimize your API calls, they can be very slow, especially when you add multiple plugins to the WordPress backend. The default WordPress REST controller loads much more information than necessary to build a basic website, leading to very long response times for simple calls.
Developers need to make adjustments to the calls to ensure high performance.
Customized, complex builds could take more time and resources
There’s no going around the fact that headless WordPress adds a layer of complexity to any WordPress-related project. While implementing it brings many benefits, it also gives your team another codebase to maintain and requires specific web development skills.
This approach is beyond the scope of non-programmer web developers who use page builders like Elementor, as you need to have deep full-stack WordPress development knowledge and balance at least two different platforms.
For some freelancers or teams, these complications may lead to more development time and resources needed for the project.
Should you use headless WordPress?
Headless WordPress is a flexible and scalable alternative for building content-driven apps while harnessing the maturity of WordPress’ content management. It’s particularly good for delivering content to multichannel businesses that need to account for websites, mobile apps, digital kiosks, and more.
That said, there will always be many web development projects that would benefit from the traditional, monolithic approach to WordPress development. Most of the time, the traditional approach works just fine for standalone sites like small-to-medium-size businesses (which is most businesses), small websites for brick-and-mortar stores, some e-commerce marketplaces, and sites that aren’t part of a multichannel network.
Ultimately, headless WordPress implementations work best for organizations with an omnichannel presence and the expertise to build and maintain such a network using a headless architecture.
However, we must consider that headless CMSs are a relatively new development that will need time to mature and express their true potential. Time will tell where headless WordPress goes from here and what new applications it may be used for.