Simple WP-CLI Commands That Make WordPress Easier

Published: (January 17, 2026 at 11:44 AM EST)
2 min read
Source: Dev.to

Source: Dev.to

Getting Basic Site Information

wp option get siteurl
wp option get home
wp core version
wp user list --fields=ID,user_login,roles
wp theme list --status=active

When to use it: Quickly check the site URL, WordPress version, users and their roles, and the active theme.

Managing Plugins

wp plugin list --status=active
wp plugin deactivate plugin-slug
wp plugin activate plugin-slug
wp plugin update --all

When to use it: View active plugins, deactivate/activate a specific plugin, or update all plugins at once.

Core Updates

wp core update

When to use it: Update WordPress core to the latest version.

Theme Updates

wp theme update --all

When to use it: Update all installed themes.

wp rewrite flush --hard

When to use it: Refresh rewrite rules after changing permalinks.

Cache and Transients

wp transient delete --all
wp cache flush

When to use it: Clear all transients and flush the object cache.

Maintenance Mode

wp maintenance-mode activate
wp maintenance-mode deactivate

When to use it: Put the site into maintenance mode during updates and deactivate it when finished.

User Management

wp user create editor1 editor@example.com --role=editor --user_pass='Password123'
wp user update editor1 --user_pass='NewPassword123'

When to use it: Create a new user or change an existing user’s password.

Listing Content

wp post list --post_type=page
wp post list --post_type=attachment --fields=ID,post_title,guid --format=table

When to use it: List pages or view media attachments as a table.

Media Management

General Media Commands

wp media

Note: wp media list is not part of core WP‑CLI; use the attachment post list instead.

Fix Image Rotation

wp media fix-orientation

When to use it: Images appear rotated after upload; this command automatically fixes orientation metadata.

View Registered Image Sizes

wp media image-size

When to use it: See which image sizes WordPress generates—useful for theme development and performance tuning.

Import Media Files

wp media import image.jpg

When to use it: Bulk‑upload files or migrate content; faster than using the browser uploader.

Regenerate Thumbnails

wp media regenerate

When to use it: After changing image sizes or switching themes to ensure images match the new settings.

Search & Replace

wp search-replace 'http://oldsite.com' 'https://newsite.com' --dry-run

When to use it: Replace URLs throughout the database; always run with --dry-run first to preview changes.

Verify Core Files

wp core verify-checksums

When to use it: Ensure core files match the official WordPress checksums.

Run PHP Code

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

When to use it: Quickly output WordPress data from the command line.

Closing Note

WP‑CLI isn’t only for advanced developers. Simple tasks—updates, users, plugins, media—become faster and less click‑heavy once you get used to the commands.

Back to Blog

Related posts

Read more »