Simply type this command to check the WP-CLI version information:
To install WP-CLI click here.
wp --info
Create directory
cd /var/www/html
mkdir demo
wp core download
wp core config --dbname=db_gutenberg --dbuser=root --dbpass=mysql123 --dbhost=localhost --dbprefix=rl_ --extra-php <<PHP
define( 'WP_DEBUG_LOG', true );
PHP
Use the following command for creating the database. Note that this command will create a fresh database with the name used in wp-config file.
wp db create
wp core install --url="http://localhost/demo" --title="demo Test" --admin_user="admin" --admin_password="admin" --admin_email="test@test.com"
Use the following command to Enable DEBUG and DEBUG LOG.
wp config set WP_DEBUG true --raw
wp config set WP_DEBUG_LOG true --raw
wp theme activate [theme name]
wp core version
wp core update
wp plugin install [plugin name]
wp theme update --all
wp plugin update --all
wp core download --skip-content --force
wp db check
wp db create
wp db drop --yes
wp db reset --yes
wp db clean --yes
wp db export
wp db export --tables=wp_options,wp_users
wp db import wordpress_dbase.sql
wp db prefix
wp db repair
wp db query < debug.sql
wp db query "CHECK TABLE $(wp db tables | paste -s -d, -);"
wp db size
wp menu create "My Menu"
wp menu list
wp menu item add-custom my-menu Apple http://apple.com --porcelain
1922
wp menu location assign my-menu primary
wp menu delete "My Menu"
wp search-replace 'http://example.dev' 'http://example.com' --precise --recurse-objects --all-tables
To regenerate all thumbnails for all images inside your WordPress media library, you can use the following command:
wp media regenerate --yes
You can regenerate thumbnails for only the missing image sizes using the --only-missing option like this:
wp media regenerate --only-missing
If you want to regenerate thumbnails for a specific image, you can specify it by including the attachment ID after the command like this:
wp media regenerate 122
To regenerate thumbnails for multiple specified attachment IDs, just add them to the command like the following example:
wp media regenerate 125 234 456
When regenerating your WordPress media library image thumbnails, the default behavior is to delete the old thumbnails. If you want to keep them, you can use the --skip-delete option:
wp media regenerate --skip-delete
wp media regenerate --image_size=large
wp media image-size
wp maintenance-mode activate
wp maintenance-mode deactivate
wp maintenance-mode status
wp maintenance-mode is-active
wp import my-file.xml
wp import my-file.xml
If you want to create any authors that don't already exist, set value of the --authors option to create like this:
wp import my-file.xml --authors=create
If you'd like to just leave the post's author empty if the user doesn't already exist, you can set the value of the --authors option to skip:
wp import my-file.xml --authors=skip
wp import my-file.xml --skip=attachment
wp import my-file.xml --skip=image_resize
wp export
wp export --dir="/my/path/here"
wp export --skip_comments
wp cron event list
If you want to trigger all currently due cron events (events that are due but haven't been run yet), you can run them with the following command:
wp cron event run --due-now
wp cache flush
wp transient delete --all
wp search-replace 'old.example.com' 'new.example.com'
wp db search 'my search string'
wp db search 'my search string' wp_posts
To view a list of all language packs that can be installed with WP-CLI, simply use the following command:
wp language core list
To get a list of the currently installed language packs for WordPress core, issue the following WP-CLI command:
wp language core list --status=installed
To install a language pack for WordPress core, just grab the language name (the list command helps with this) and install it using the install subcommand like this:
wp language core install es_ES
wp language core activate es_ES
wp language core uninstall es_ES
wp language core update
wp i18n make-pot /var/www/html/demo/wp-content/themes/hello-world/ /var/www/html/demo/wp-content/themes/hello-world/languages/hello-world.pot
wp i18n make-pot /var/www/html/demo/wp-content/plugins/hello-world-addons/ /var/www/html/demo/wp-content/plugins/hello-world-addons/languages/hello-world-addons.pot
wp plugin activate hello
wp plugin deactivate hello
wp plugin deactivate --all
wp plugin delete hello
wp plugin install bbpress --activate
wp plugin list --status=active --format=json
wp plugin uninstall hello
wp plugin update bbpress --version=dev
wp plugin update --all
Update all plugins except akismet
wp plugin update --all --exclude=akismet
wp plugin install wordpress-seo --version=4.8 --activate
curl -O https://wpcom-themes.svn.automattic.com/demo/theme-unit-test-data.xml
wp plugin install wordpress-importer --activate
wp import ./theme-unit-test-data.xml --authors=create
rm theme-unit-test-data.xml