Execute WP-Cron on multisite through wp-cli
#!/bin/bash | |
function run_cron_due_now { | |
for SITE_URL in $(wp --allow-root site list --fields=url --format=csv | tail -n +2 | sort); do | |
wp --allow-root cron event run --due-now --url="$SITE_URL" && echo -e "\t+ Completed Crons for $SITE_URL" & | |
done | |
wait $(jobs -p) | |
echo "Done" | |
} | |
run_cron_due_now |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment