crontool
Paste a schedule, read it in English, see the next runs.

Run a WP-CLI Command from Cron

To run WP-CLI from cron, call the wp binary with its full path and point it at your site with --path. Run it as the web-server user, not root.

The command

*/15 * * * * /usr/local/bin/wp cron event run --due-now --path=/var/www/html >> /var/log/wpcli.log 2>&1

This is the standard pattern for replacing WordPress's traffic-triggered pseudo-cron with real cron (see also the wp-cron page). Use the full path to wp; cron's PATH won't find it otherwise.

Run as the right user

WP-CLI complains when run as root. Put the line in the crontab of the web user (e.g. sudo -u www-data crontab -e) so file permissions match Apache/PHP-FPM.

Any command works

Swap in any WP-CLI command, e.g. a nightly cache flush: 0 3 * * * /usr/local/bin/wp cache flush --path=/var/www/html.

FAQ

How do I run WP-CLI from cron?

Call wp with its full path and the --path flag: */15 * * * * /usr/local/bin/wp cron event run --due-now --path=/var/www/html. Run it as the web user.

Why does WP-CLI warn about running as root in cron?

WP-CLI blocks root by default for safety. Put the job in the web user's crontab (sudo -u www-data crontab -e) so permissions match PHP-FPM.

How do I replace WordPress pseudo-cron with real cron?

Disable WP-Cron in wp-config and run wp cron event run --due-now on a schedule like every 15 minutes via system cron.