The last couple weeks a couple WordPress sites went offline when our server ran out a space. While the applications were still online a responding, MySQL ran into a lock problem which blocked WordPress from connecting the the database. This caused each site to show a database error message and WordPress’ wp_die
handler page.
I brushed off some old code, cleaned it up with some PHP 8 goodness, and pushed it to a GitHub repo!
Requirements: Your WordPress needs to be running Composer at the root level, including it’s autoload.php
file in your wp-config.php
or bootstrap file.
Visit WP Health Check for information on how to install the package. Once deployed to your website, you should be able to ping your website at GET: /meta/health-check/?
and receive a JSON response like: {"errors":null,"status":"OK"}
The n8n automation to validate your websites health
I created a four node workflow to hit my site(s) every hour, and send the response data to a Slack workspace.
Nodes used:
- Schedule Trigger: Set to trigger every hour on the hour.
- HTTP Request: Send a GET request to <website>/meta/health-check/.
- If: Check
response
code and do X or Y. - Slack: Send a Slack message with the response code.

The If node conditions
The first If node has a true/false return based on the health check response status.

If status
is equal to “OK”, move to the next If node. If it’s false, send a Slack message:

When the status is OK, we can move on to the second If node (optional) where I’ve decided to only send the OK response to Slack once a day. The second node get data from Schedule Trigger like: {{ $('Schedule Trigger').item.json.Hour }}
and if it’s 11 AM, will send a Slack message.
The final step is No Operation, do nothing node. Which does exactly that, ends the workflow.