WordPress runs jobs such as scheduled posts, backups and emails through wp-cron.php. By default this check runs on every visit. Setting up a real scheduled task (cron) both speeds up the site and makes sure jobs run on time.
- Turn off WordPress's own cron in
wp-config.php. - Add a task in Plesk that runs
wp-cron.phpevery 5 minutes. - Optionally block outside access to
wp-cron.php.
Why does the default wp-cron cause problems?
- Performance: On busy sites, the check on every page load puts unnecessary load on the server.
- Timing: On sites with few visitors, scheduled posts are published late and backups do not start.
- Security:
wp-cron.phpcan be called repeatedly from outside to slow your site down.
1. Turn off WordPress's own cron
Add this to wp-config.php above the /* That's all, stop editing! */ line:
define( 'DISABLE_WP_CRON', true );
2. Add a scheduled task in Plesk
- Log in to your Plesk panel at
https://yourdomain.com:8443or from the service page in your client area. - On the Websites & Domains page, click Scheduled Tasks and choose Add Task.
- Choose Run a PHP script as the task type and select
httpdocs/wp-cron.phpas the script path. Choose the PHP version your site uses. - In Run, choose Cron style and enter
*/5 * * * *. The task runs every 5 minutes. - Click OK. To test the task right away, use Run Now in the list.
If your site's settings in WP Toolkit have a Take over wp-cron.php option, Plesk does these two steps for you. General information on scheduled tasks: How to create a cron job
3. Block outside access (optional)
After setting up a real cron, you can block outside calls to wp-cron.php with .htaccess. The Plesk task is a Run a PHP script task, so this rule does not affect it:
# wp-cron.php cannot be called from outside
<Files wp-cron.php>
Require all denied
</Files>
If you set up the task as Fetch a URL, do not add this rule; the task would be blocked too.
