Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[wp-cli] wp-cli と jq で wp-cron に登録されているイベントをすべて実行する
#!/bin/sh
wp_root="/path/to/wordpress"
wp="wp --path=${wp_root}"
hooks=`${wp} cron event list --format=json | jq -r '.[] | select(.next_run_relative == "now") | .hook'`
for hook in ${hooks} ; do
echo "***** run event ${hook} *****"
${wp} cron event run ${hook}
echo ""
done
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.