Cron jobs not working in WordPress plugin in a VPS with VestCP control panel

Recently I bought a small package of VPS to start working on a website. To make server configuration stuff easy, I installed VestaCP. I have installed WordPress on the server, then the necessary theme and plugins.

A plugin of the website needs to fire scheduled/cron work on every 5 minutes. The problem is the scheduled jobs from the plugin are not running, though the site on a cPanel based VPS is working.

I want to know what configuration needs to update in my VPS to make the server run scheduled work from the WordPress plugins?

Topic vps plugins Wordpress

Category Web


I'd guess this is because your new website isn't getting any traffic.

By default WordPress doesn't have any background processes to run scheduled jobs on, and instead runs them when it next gets a web request after the scheduled start time. Hence it needs a constant stream of web traffic to run scheduled jobs on time. See Cron in the WordPress documentation.

To fix this, you can set up a scheduled job using the VPN's system cron to trigger WordPress's cron jobs. Again from the WordPress documentation: Hooking WP-Cron Into the System Task Scheduler, e.g. cron configuration

*/5 0 * * * wget --delete-after http://YOUR_SITE_URL/wp-cron.php

If you have many long-running jobs there are also plugins that will run WordPress scheduled tasks in a separate service for you.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.