Skip to content

Instantly share code, notes, and snippets.

@corypina
Created September 9, 2021 16:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save corypina/176de522d36ab19edd3d9117d2ede3f9 to your computer and use it in GitHub Desktop.
Save corypina/176de522d36ab19edd3d9117d2ede3f9 to your computer and use it in GitHub Desktop.
Ping WordPress cron to manage cron jobs externally. For use in AWS Lambda, etc.
const https = require("https");
let url = "https://domain.com/wp-cron.php?doing_wp_cron";
exports.handler = function (event, context, callback) {
https
.get(url, (res) => {
callback(null, res.statusCode);
})
.on("error", (e) => {
callback(Error(e));
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment