WP-CLI - Install and Activate multiple plugins

# install and activate "debug-bar" & "debug-bar-console" plugins=("debug-bar" "debug-bar-console"); for p in "${plugins[@]}" ; do wp plugin install "$p" --activate; done : " Installing Debug Bar (0.8.4) Downloading install package from https://downloads.wordpress.org/plugin/debug-bar.0.8.4.zip... Unpacking the package... Installing the plugin... Plugin installed successfully. Activating 'debug-bar'... Success: Plugin 'debug-bar' activated. Installing Debug Bar Console (0.3) Downloading install package from https://downloads.wordpress.org/plugin/debug-bar-console.0.3.zip... Unpacking the package... Installing the plugin... Plugin installed successfully. Activating 'debug-bar-console'... Success: Plugin 'debug-bar-console' activated. " : ' Alternate ' for p in "debug-bar" "debug-bar-console"; do wp plugin install "$p" --activate; done

2 Responses

Why not install multiple plugin this way. ?
wp plugin install wordpress-importer cmb2 contact-form-7 jetpack mailchimp-for-wp recent-posts-widget-extended redux-framework woocommerce woocommerce-gateway-paypal-express-checkout woocommerce-services wp-fastest-cache --activate
@Zaheer Abbas Aghani I think in this example I was playing with Bash more than wp-cli. You're correct, you can pass multiple arguments to the command on a single line, so the default usage is much more efficient. Thank you for sharing.

Write a comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.