WordPress WP-CLI 2 cheatsheet

WordPress WP-CLI 2: Content and options

9 common WordPress WP-CLI 2 tasks.

List posts

Show posts with their status.

wp post list

Create a post

Create and publish a post.

wp post create --post_title="Hello" --post_status=publish

Read a site option

Print the site URL stored in the options table.

wp option get siteurl

Change a site option

Change the site title stored in the options table.

wp option update blogname "New Site Title"

Fix permalinks

Regenerate rewrite rules, which fixes most pages that return 404 after a change.

wp rewrite flush

Clear the object cache

Flush the WordPress object cache.

wp cache flush

Delete transients

Delete all cached transient values.

wp transient delete --all

Run due scheduled tasks

Run all WP-Cron events that are due now.

wp cron event run --due-now

Turn on debug mode

Set WP_DEBUG to true in wp-config.php.

wp config set WP_DEBUG true --raw

Was this page helpful?