It's 2022 but all over Reddit, if someone asks for a headless CMS suggestion, WP is still one of the top comments. The Payload team has built headless WP sites for almost 7 years, and it certainly had its place, but its time is now over. Using it in a headless context is no longer relevant.
This repo shows why. It includes a WordPress site with a typical ACF usage example as well as how to replicate that exact same functionality in Payload. You can run both projects on your own machine to see the difference in developer experience for yourself.
Here are the steps that you need to follow to get up and running with the copy of Payload in this repo. Make sure you have a local copy of MongoDB installed. Or, sign up for a free Mongo Atlas account and paste the connection string to your DB into your .env
file.
cd ./payload
cp .env.example .env
to make an environment fileyarn
yarn dev
For the WP demo, you'll need Docker installed. Once you have Docker, here are the steps to follow:
cd ./wordpress
cp docker-compose.example.yml docker-compose.yml
- Make sure the Docker Compose configuration looks good and change it to suit your environment if necessary
docker-compose up -d
- Go to
http://localhost:8000
and set up your website - Activate all plugins
- Activate the
migrate-from-wordpress
theme
Once you've got both environments up and running, you should compare and contrast the code of each app and make up your own mind.
We've included a sample GraphQL query for both Payload and WP, and you can give each a test-run for yourself. Make sure to create some documents and play around in each admin panel before trying to query, because otherwise there won't be any content to query!
Payload's query can be found at ./payload/query.graphql
and you can use the GraphQL Playground at http://localhost:3000/api/graphql-playground to check it out.
WordPress' query can be found at ./wordpress/query.graphql
and you can use the GraphiQL page within the WP dashboard to play around.
At Payload, we think that WordPress certainly does have a time and place, but we don't feel that its place is within the headless ecosystem. It just isn't built for it. But it's still perfectly valid for no-code solutions and small, budget-focused websites that only require an off-the-shelf theme. However, if you're building a custom JAMstack website, we feel strongly that there is no reason to use it over the likes of Payload or other more purpose-built headless CMS.