Skip to content

Scheduled tasks (cron)

Run your own commands on a schedule by adding them to your site's crontab file.

WordPress cron is handled for you

WordPress's own scheduled tasks — scheduled posts, plugin jobs, and more — run automatically on CloudPress. There is nothing to set up.

Adding your own scheduled tasks

If you need to run your own commands on a schedule — a maintenance script, a WP-CLI command, a call to an external service — add them to the crontab file at the root of your site's volume:

/home/sftpuser/apps/{{ container name }}/wordpress/crontab

Reach it with any file-access method — SFTP, SSH, the File Manager, or Cloud Shell. See Accessing your files for how to connect.

  1. Open (or create) the crontab file in your site's wordpress folder.

  2. Add one line per job: the five schedule fields, then the user to run as (always www-data), then the command. For example, to clear expired transients every night at 3:15 AM:

15 3 * * * www-data wp --path=/var/www/html/wordpress transient delete --expired
  1. Restart the site. In the dashboard, open the site's Settings and use the Restart action. New or changed jobs apply after a restart.

Two things that trip people up

  • The user field is required. Leaving out www-data is the most common reason a job doesn't run.
  • Commands run on the server, not in your SFTP login. WordPress lives at /var/www/html/wordpress there, so pass that to wp --path=…. Use full paths to programs (for example /usr/bin/curl) if a command isn't found.

Leave the wp-cron line in place

If your crontab file contains a wp-cron line, leave it there. Removing it stops WordPress's scheduled tasks.

Removing a custom job

Delete the line from the crontab file and restart the site. Removing your own lines won't affect the built-in WordPress cron.