Automatic deployment to Hostinger from GitHub
How to publish a site to Hostinger automatically from a GitHub repository: Git deployment in hPanel, a webhook, a GitHub Actions build and keeping secrets safe.

WordPress, having started as a content management platform, has undergone significant evolution. Today, it not only manages websites in the traditional format but can also function in a headless architecture, serving solely as a backend system for content management. In this article, we will explore the key benefits of using WordPress as a backend, its integration with modern frontend frameworks, and dive into the details of working with WP REST API for efficient data interaction.
Headless WordPress is an approach where the frontend and backend are decoupled. WordPress handles content on the backend, while the frontend rendering and user interactions are managed by separate systems such as React, Vue.js, or Angular. This allows developers to create more flexible user interfaces using the latest web technologies.
WordPress as a backend system in headless architecture provides several important benefits for development.
Users continue to work in the familiar WordPress dashboard, publishing and updating content without needing to dive into technical details. This is especially helpful for teams where content is managed by non-technical users.
WordPress has one of the richest plugin ecosystems. Plugins can be used for SEO, security, social media integration, and even to simplify working with APIs. This speeds up development and extends WordPress’s functionality without needing to write custom code.
WordPress integrates easily with other systems and applications. Its API allows content to be delivered across multiple channels — web applications, mobile apps, and IoT devices. This makes WordPress a versatile solution for companies needing centralized content management across various platforms.
WordPress is supported by millions of developers and enthusiasts worldwide. This ensures the availability of documentation, forums, and solutions for nearly any task, reducing development time and costs.
The WP REST API is an interface that allows interaction with WordPress through HTTP requests. It’s one of the core tools in headless architecture, enabling data to be queried, updated, and deleted on the backend while being displayed on any frontend framework.
/wp-json/wp/v2/posts/wp-json/wp/v2/pages/wp-json/wp/v2/categories/wp-json/wp/v2/media/wp-json/wp/v2/users/wp-json/wp/v2/commentsGET https://example.com/wp-json/wp/v2/posts
The response will be in JSON format and may include data such as the post ID, title, content, and excerpt:
[
{
"id": 1,
"title": {
"rendered": "Post Title"
},
"content": {
"rendered": "Post content."
},
"excerpt": {
"rendered": "Post excerpt."
}
},
...
]
REST API supports filtering data via URL parameters:
?per_page=5 — limits the number of posts per page.?page=2 — fetches the second page of results.?orderby=date&order=asc — sorts posts by date in ascending order.GET https://example.com/wp-json/wp/v2/posts?per_page=5&page=2
GET https://example.com/wp-json/wp/v2/posts/1
This request will return the post with ID 1, including its title, content, and other fields.
GET https://example.com/wp-json/wp/v2/categories
The response will include the list of categories, their IDs, names, and descriptions.
To create a new post, use the POST method:
POST https://example.com/wp-json/wp/v2/posts
The request body might look like this:
{
"title": "New Post",
"content": "Content of the new post",
"status": "publish"
}
The response will contain the ID of the new post and its data.
To modify an existing post, use the PUT method:
PUT https://example.com/wp-json/wp/v2/posts/15
Request body:
{
"title": "Updated Title"
}
To delete a post, send a DELETE request:
DELETE https://example.com/wp-json/wp/v2/posts/15
For operations such as creating or deleting data, authentication is required. WordPress supports several authentication methods:
Install the Basic Auth plugin and activate it through the WordPress admin panel. After that, you can send HTTP requests with an authentication header.
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
If the standard REST API routes do not meet your project’s needs, you can create custom endpoints using the register_rest_route hook.
add_action( 'rest_api_init', function () {
register_rest_route( 'myplugin/v1', '/custom-data/', array(
'methods' => 'GET',
'callback' => 'my_custom_data_callback',
) );
} );
function my_custom_data_callback( $data ) {
return new WP_REST_Response( array( 'message' => 'Hello World!' ), 200 );
}
Now, at the URL https://example.com/wp-json/myplugin/v1/custom-data/, the custom route will return the message “Hello World!”.
WordPress as a Headless CMS offers a powerful platform for creating flexible, high-performance, and scalable solutions. Using WP REST API, developers can easily integrate WordPress with modern frontend technologies, while the flexibility of the system allows for working with custom routes and extending functionality. This approach opens up endless possibilities for integrating WordPress into various projects, from simple blogs to complex web and mobile applications.
Need help with this?
Improving an existing WordPress site: new features, integrations, design changes and faster code, done with AI tools and reviewed by hand. From €60 + VAT.
More about the service →
Local machine → repository → server: you ask, an AI agent changes the site, every change is reviewed, saved and deployed automatically. I set it up and teach your team.
How it works →

How to publish a site to Hostinger automatically from a GitHub repository: Git deployment in hPanel, a webhook, a GitHub Actions build and keeping secrets safe.

Two ways to put a WordPress site under Git: keep the theme and plugins in a repository, or export the content into a static site. What to commit and how to deploy.

How managing a website through an AI coding agent works: what to prepare, the cycle from request to publishing, and which tasks to trust an agent with.

Contact
An AI agent, an automation, a website improvement or a full rebuild — describe the task in a few lines and I will reply within one business day.
Tallinn, Estonia · working remotely across Europe
The site does not use cookies. Visit statistics are collected without them. Learn more