Skip to content

Instantly share code, notes, and snippets.

@wptraining
wptraining / wp-search-replace-all-tables.cl
Created April 21, 2020 06:24
Things you can do with wp-cli
# 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
@wptraining
wptraining / wp-search-replace.cl
Created April 21, 2020 06:23
Things you can do with wp-cli
# 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"
@wptraining
wptraining / wp-core-update.cl
Created April 21, 2020 06:22
Things you can do with wp-cli
wp core update --version=4.6.1 --force
@wptraining
wptraining / wp-theme-activate.cl
Created April 21, 2020 06:21
Things you can do with wp-cli
# 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
@wptraining
wptraining / wp-plugin-deactivate.cl
Created April 21, 2020 06:19
Things you can do with wp-cli
# 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
@wptraining
wptraining / wp-plugin-update.cl
Created April 21, 2020 06:18
Things you can do with wp-cli
# 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
@wptraining
wptraining / wp-theme-update.cl
Created April 21, 2020 06:16
Things you can do with wp-cli
# 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
@wptraining
wptraining / wp-plugin-install.cl
Created April 21, 2020 06:12
Things you can do with wp-cli
wp plugin install wp-smushit custom-sidebars
@wptraining
wptraining / wp-plugin-search.cl
Created April 21, 2020 06:10
Things you can do with wp-cli
wp plugin search smush
@wptraining
wptraining / wp-plugin-list.cl
Created April 21, 2020 06:08
Things you can do with wp-cli
wp plugin list