A Blog built with Next.js using Headless WordPress (REST API).
View Demo
·
Report Bug
·
Request Feature
This blog uses a WordPress Headless CMS (via REST API) for the backend and Next.js for the frontend.
Key features include:
- Responsive design
- Dynamic content
- Blog post search
- Content Pagination
- Header with interactive navigation
- Proper loading, error, 404 states
- Fast, optimized images in production
- WordPress + MySQL Docker setup
| Homepage | Search Page |
|---|---|
![]() |
![]() |
| Single Post Page | 404 Page |
![]() |
![]() |
Follow these steps to set up the project locally or deploy it in production.
- Use a production WordPress hosting provider (e.g., Hostinger, WP Engine, Kinsta, or SiteGround). Or any other production ready method.
- Go to
Restore Demo Datasection for the next steps.
- Use Vercel for seamless deployment of the Next.js frontend.
- Configure the WordPress REST API endpoint in the
.envfile in the Next.js app. Use the.example.envas a exmaple.
Ensure you have the following installed:
git clone https://github.com/DevHanza/nextjs-wordpress-blog.git
cd nextjs-wordpress-blog
- Run
pnpm installORnpm install - Configure the WordPress endpoints in the
.envfile. Use the.example.envas a exmaple.
- Run:
pnpm docker-devORnpm run docker-dev. - Access the WordPress dashboard at
localhost:8080.
- Go to the
Wordpress Dashboard > Plugins > Add New. - Install the Simple Local Avatars plugin.
- Install the WPvivid Backup Plugin plugin.
- Restore the backup using
.zipfile in the./demo-data/directory. (guide) - Use these credentials to login after backup.
Username: devhanza
Password: 0LpQPDwgnAu1Y
- You MUST install the Simple Local Avatars plugin.
- You MUST Add the code snippets in
.phpfiles inside/demo-data/snippetsto thefunctions.phpin your theme to extend the REST API.
- Run
pnpm devORnpm run dev.
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.




