Run wp cli commands with cron job
Yes, you can.
Here's a line from my crontab
file. (You can edit it by running crontab -e
)
*/10 * * * * /var/www/vendor/wp-cli/wp-cli/bin/wp --path=/var/www/ update-credits
This runs my WP-CLI command update-credits
every 10 minutes.
NOTE: I'm using WP-CLI as a Composer dependency in that website. The path to your wp
binary may vary.