Wordpress Cron Using Google App Script
Have you ever wondered that you can use Google App Script to create an alternate cron for wordpress wp-cron.php ? Most of the websites have issues with running wp-cron.php properly.
Wanna know ? Then read on….
Lots of website developers or bloggers face issues with WordPress cron. If your website has less number of visitors then your wordpress cron may not run.
wp-cron.php is ran everytime someone visits a page of your website. So if you have scheduled a blog post to be published at particular time and if there is no visit at that time, then probably your scheduled post publishing time is gonna miss.
So alternate solution to WordPress cron not executing properly is, use external service. And call your wp-cron.php file.
You will find lots of services which offer you to create a cron job. Some of them are free, some are paid. And might have different limitations.
So, today I am going to show you how you can create your own Cron for wordpress, and execute your wp-cron.php file as per your choice. eg. Run wordpress wp-cron.php file every minute or every 5 minutes, hourly, daily etc.
If you are facing issues with WordPress Cron job not working, then here is alternate solution to make WordPress Cron working without paying any money.
We are going to use Google App Script for creating a cron schedule. Its very easy to use Google Scheduled Triggers to execute jobs regularly. It can used for executing recurring jobs eg. fetching data from, trigger a page url etc.
If you are creating your first Google App Script then visit my previous blog post about, how you can use Google App Script for fetching contents from RSS feed and schedule that as Cron job. I have explained complete process with screenshots for first timers.
You can always watch video below, it has all steps.
Following is our Google App Script for executing wordpress wp-cron.php url as cron.
/*
Google Apps Script for Creating a free WordPress wp-cron.php CRON Job
@prowebguru
https://www.prowebguru.com/
*/
function executeWordpressCronJob() {
// Get Active Spreadsheet
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
// Access cell A1
var dataRange = sheet.getRange("A1");
// Get URL from cell A1
var data = dataRange.getValues();
var date = new Date();
var row = data[0];
var websiteAddress = row[0]; // First column, now contains URL
var response;
try {
response = UrlFetchApp.fetch(websiteAddress);
if(response.getResponseCode() == 200) {
sheet.appendRow([date,'Successful']);
} else {
sheet.appendRow([date,'Issue']);
}
} catch(e) {
if(e.toString().indexOf('returned code 404') > -1)
sheet.appendRow([date,'404 Url not found']);
else
sheet.appendRow([date,e]);
}
SpreadsheetApp.flush();
}
Its done. You have created your WordPress wp-cron.php cron job using Google Spreadsheet and Google App Script. Our code also has capability to keep a record of every execution. If you don’t want to keep a track of every execution, then just remove or comment lines having “sheet.appendRow”.
You can also extend this script to run cron job for multiple wordpress sites/urls. Or read data from list of urls and then process it.
Is it useful to you ? Did it solve your issues ?
GPT 5.4: The Next-Generation AI Model Transforming Reasoning, Coding, and Productivity Artificial Intelligence is evolving…
GPT-5.3 Instant is OpenAI's latest ChatGPT model update, prioritizing smoother conversations, fewer refusals, and higher…
Are you tired of scrolling endlessly through Google results trying to find clear, trustworthy answers?…
In recent years, the process of software development has rapidly evolved—developers demand smarter tools and…
India has emerged as one of the fastest-growing and most significant markets in the global…
On October 6, 2025, OpenAI unveiled AgentKit, a unified suite of tools designed to help developers and…
This website uses cookies.