Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Chained WordPress CLI commands to install and activate recommended plugins.
# wordpress-seo provides ability to edit meta information and provides sitemap.
# w3-total-cache provides advanced caching no matter the server technology available.
# better-wp-security provides brute force protection and a number of WordPress enhancements.
# google-analytics-for-wordpress provides robust Google Analytics integration through the Google API.
# redirection detects 404s and 301s and allows admins to set up redirects in the WP admin.
# ewww-image-optimizer provides automatic optimization of uploaded images with local libraries instead of cloud-based services.
# backupwordpress simple backup solution that can store backups above web root.
# relevanssi provides better site search using a local index.
# cloudflare is the best. Free automatic CDN and security solution.
# jarvis is a quick search for the WordPress admin. Indespensible.
# Array of plugin slugs as listed above. h/t @wpbullet
plugins=( wordpress-seo w3-total-cache better-wp-security google-analytics-for-wordpress redirection ewww-image-optimizer backupwordpress relevanssi cloudflare jarvis )
# Install and activate each plugin. h/t @blindpet Trevor Anderson Mike Andreasen
wp plugin install --activate ${plugins[@]}

This comment has been minimized.

Copy link

blindpet commented Sep 30, 2016

Each line can be reduced to

wp plugin install wordpress-seo --activate


This comment has been minimized.

Copy link

wpbullet commented Sep 30, 2016

Nice work, you can also use an array and one line them, WP-CLI is smart enough to know what to do with the spaced list

#array of plugins
WPPLUGINS=( wordpress-seo ewww-image-optimizer better-wp-security )
wp plugin install ${WPPLUGINS[@]} --activate

Documented them here


This comment has been minimized.

Copy link
Owner Author

MikeNGarrett commented Sep 30, 2016

Thanks for the feedback. Updated.

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.