Skip to content

Instantly share code, notes, and snippets.

@MikeNGarrett
Last active July 12, 2021 07:18
Show Gist options
  • Save MikeNGarrett/fa4216b34495573e433f2e1d945c4569 to your computer and use it in GitHub Desktop.
Save MikeNGarrett/fa4216b34495573e433f2e1d945c4569 to your computer and use it in GitHub Desktop.
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[@]}
@wpbullet
Copy link

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

@MikeNGarrett
Copy link
Author

Thanks for the feedback. Updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment