Skip to content

Instantly share code, notes, and snippets.

@basterrika
Created September 18, 2020 07:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save basterrika/d954a881ac06182d04cfd74321d547d0 to your computer and use it in GitHub Desktop.
Save basterrika/d954a881ac06182d04cfd74321d547d0 to your computer and use it in GitHub Desktop.
Handle WordPress and WooCommerce updates
# This file must go in the WordPress installation root
# Core updates on multisite network
if $( wp core is-installed --network ); then
wp core update-db --network
fi
# Handle WooCommerce database updates on multisite if installed
if $( wp plugin is-installed woocommerce ) && $( wp core is-installed --network ); then
for site_id in $( wp site list --field=blog_id ); do
site_url=$( wp site list --field=url --blog_id=${site_id} )
if $( wp plugin is-active woocommerce --url=$site_url ); then
wp wc update --url=${site_url}
fi
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment