WordPress WP-CLI 2 cheatsheet

WordPress WP-CLI 2: Updates and maintenance

10 common WordPress WP-CLI 2 tasks.

Update WordPress

Update WordPress to the latest version.

wp core update

Caution: Back up the files and database first.

Run database updates

Run the database upgrade that some releases require.

wp core update-db

Check core files for tampering

Compare WordPress core files with the official checksums.

wp core verify-checksums

Check plugin files

Compare plugins from WordPress.org with their official checksums.

wp plugin verify-checksums --all

Turn on maintenance mode

Show the maintenance page to visitors while you work.

wp maintenance-mode activate

Turn off maintenance mode

Put the site back online.

wp maintenance-mode deactivate

Run PHP in WordPress

Run a PHP snippet with WordPress loaded.

wp eval 'echo get_bloginfo("version");'

Open an interactive PHP shell

Start a shell with WordPress loaded for trying out functions.

wp shell

Generate a plugin skeleton

Create a plugin folder with the standard files.

wp scaffold plugin my-plugin

Update WP-CLI

Update WP-CLI itself to the latest release.

wp cli update

Was this page helpful?