Created
July 6, 2023 03:27
-
-
Save samjaninf/3229ad246e78b89935d4d24d30e771dd to your computer and use it in GitHub Desktop.
wordpress_updates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Plugin updates | |
wp plugin update --all --allow-root | |
wp plugin update --all --skip-plugins --skip-themes --allow-root | |
# Theme updates | |
wp theme update --all --allow-root | |
wp theme update --all --skip-plugins --skip-themes --allow-root | |
# Core updates | |
wp core update --allow-root | |
wp core update-db --allow-root | |
# Core updates on multisite network | |
if $( wp core is-installed --network --allow-root ); then | |
wp core update-db --network --allow-root | |
fi | |
# Handle WooCommerce database updates if installed | |
if $( wp plugin is-installed woocommerce --allow-root ); then | |
wp wc update --allow-root | |
fi | |
# Handle WooCommerce database updates on multisite if installed | |
if $( wp plugin is-installed woocommerce --allow-root ) && $( wp core is-installed --network --allow-root ); then | |
for site_id in $( wp site list --field=blog_id --allow-root ); do | |
site_url=$( wp site list --field=url --blog_id=${site_id} --allow-root ) | |
if $( wp plugin is-active woocommerce --url=$site_url --allow-root ); then | |
wp wc update --url=${site_url} --allow-root | |
fi | |
done | |
fi | |
# Handle Elementor database updates if installed | |
if $( wp plugin is-installed elementor --allow-root ); then | |
wp elementor update db --allow-root | |
# Handle Elementor database updates on multisite | |
if $( wp core is-installed --network --allow-root ); then | |
wp elementor update db --network --allow-root | |
fi | |
fi | |
# Handle Elementor Pro database updates if installed | |
if $( wp plugin is-installed elementor-pro --allow-root ); then | |
wp elementor-pro update db --allow-root | |
# Handle Elementor Pro database updates on multisite | |
if $( wp core is-installed --network --allow-root ); then | |
wp elementor-pro update db --network --allow-root | |
fi | |
fi | |
# Handle redirection database updates if installed | |
if $( wp plugin is-installed redirection --allow-root ); then | |
wp redirection database upgrade --allow-root | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment