Skip to content

Instantly share code, notes, and snippets.

@jpen365
Last active October 7, 2019 12:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jpen365/088da8094620057e5068435ef93e34d9 to your computer and use it in GitHub Desktop.
Save jpen365/088da8094620057e5068435ef93e34d9 to your computer and use it in GitHub Desktop.
Things you can do with wp-cli
wp core config --dbname=database_name --dbuser=database_user --dbpass=user_password --dbhost=localhost --dbprefix=wp_
wp core install --url=example.com --title=Website-Name --admin_user=Unique_User --admin_password=$tron9Pa55w0rd --admin_email=email@example.com
wp core update --version=4.6.1 --force
# Deactivate a plugin
wp plugin deactivate hello-dolly
# Deactivate and uninstall a plugin
wp plugin deactivate hello-dolly --uninstall
# Uninstall a previously deactivated plugin
wp plugin uninstall hello-dolly
# Deactivate all plugins
wp plugin deactivate --all
# Force plugin to a previous version after bad update
wp plugin install hello-dolly --version=1.5 --force
wp plugin install wp-smushit custom-sidebars
wp plugin search smush
# Check for plugin updates
wp plugin list
# Check which plugins WP-CLI can update
wp plugin update --all --dry-run
# Update all plugins
wp plugin update --all
# Update a single plugin
wp plugin update smushit
# Search and replace a custom table and core table
wp search-replace "old-string" "new-string" wp_custom_table wp_posts
# Search and replace all tables, including custom tables
wp search-replace "old-string" "new-string" --all-tables
# Check number of times string will be replaced
wp search-replace "http://olddomain.com" "http://newdomain" --dry-run
# Replace old domain with new domain
wp search-replace "http://olddomain.com" "http://newdomain.com"
# Update URL to https
wp search-replace "http://example.com" "https://example.com"
# Activate a theme
wp theme activate twentyseventeen
# Delete a deactivated theme
wp theme delete twentysixteen
# Disable a theme on a multisite network
wp theme disable twentysixteen
# Enable a theme on a multisite network
wp theme enable twentyseventeen
# Install Tortuga from WordPress.org (https://wordpress.org/themes/tortuga/)
wp theme install tortuga
# Install a Theme Store Locally
wp theme install ../tortuga.zip
# Install a Theme Stored Remotely
wp theme install https://github.com/jpen365/five-hacks-for-twenty-seventeen/archive/1.0.zip
# Check for theme updates
wp theme list
# Check which themes WP-CLI can update
wp theme update --all --dry-run
# Update all themes
wp theme update --all
# Update one theme
wp theme update twentyseventeen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment