Skip to content

Instantly share code, notes, and snippets.

@tott tott/run-wp-cron.sh
Created Nov 16, 2019

Embed
What would you like to do?
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
You can’t perform that action at this time.