Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

WP-CLI is WordPress’s official command-line interface. It lets you administer a specific WordPress installation from a terminal, repeat the same operation consistently, and place routine work in shell scripts, cron jobs, or deployment pipelines. The essential command families are wp core, wp plugin, wp theme, wp user, wp option, wp db, wp search-replace, and the maintenance commands for cron, cache, transients, maintenance mode, and rewrite rules.

Use the commands below with an explicit target, a current database backup, and the narrowest scope that meets the task. A terminal command can change the live site just as quickly as the WordPress dashboard can, but it is also easier to audit and automate.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Before running any WP-CLI command

WP-CLI operates on the installation it can find from your current directory or from the global parameters you provide. The most dangerous mistake is running a valid command against the wrong site. Establish the target and your privileges before changing anything.

Inspect the runtime and read command help

  1. Run wp --info to inspect the WP-CLI version, PHP binary, operating system, and related runtime details.
  2. Check the command syntax with wp help <command>, such as wp help plugin update. Command-specific help includes accepted arguments, global parameters, and examples.
  3. Confirm the WordPress version with wp --path=/var/www/html core version when the installation is not the current directory.

Global parameters can be combined with most commands. The important ones are:

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application:Upgraded attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Warranty & Support: Our Electric air duster comes with 5 years warranty and 24/7 customer service. During this period, if you have any questions,pls kindly feel free to contact us.
  • --path=/var/www/html selects a local installation explicitly.
  • --url=https://example.com selects a site, which is especially important in multisite.
  • --ssh=user@example.com/var/www/html executes against a remote installation through SSH when the connection is configured.
  • --user=<login-or-id> sets the WordPress user context for commands that need one.
  • --skip-plugins and --skip-themes bypass loading extensions while troubleshooting a fatal plugin or theme.
  • --require=<file>, --exec=<php>, --debug, --prompt, and --alias support advanced scripting and fleet management.

Use a safe operating sequence

  1. Identify the installation with --path, the site with --url when needed, and the account with --user if permissions matter.
  2. Read the relevant help page and run a read-only listing command first.
  3. Export the database before an update, import, deletion, or replacement: wp db export backup-$(date +%F).sql.
  4. Use --dry-run where supported, particularly for search-and-replace operations.
  5. Start with a specific plugin slug, table set, site URL, or other narrow scope. Expand to --all or --network only after reviewing the output.
  6. Test updates on staging when available, then check logs and the public site.
  7. Keep passwords and database secrets out of command history, source control, and shared scripts. Use an interactive prompt, protected environment variables, or a secret manager.

Core WordPress updates and verification

The wp core family handles the WordPress files and database migrations that normally appear in the dashboard.

Check the installed version and available releases

wp core version
wp core check-update

The first command prints the installed version. The second reports whether an update is available without applying it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Update core and run database migrations

wp core update
wp core update-db

wp core update downloads and installs the selected WordPress release. After a core change, wp core update-db runs any pending database upgrade routines. Back up first and use staging when possible, because a core update can expose incompatibilities in plugins, themes, PHP versions, or custom code.

Verify core files

wp core verify-checksums

This compares core files with the official checksums for the installed release when checksum data is supported. A mismatch can indicate an altered, damaged, or incomplete file; it does not prove that a site is secure, because custom files and database content are outside the check.

Install, activate, update, and troubleshoot plugins

List installed plugins

wp plugin list

The listing shows installed plugins and their status, giving you a safe inventory before an update or troubleshooting session.

Install and activate a plugin

wp plugin install <slug> --activate

Replace <slug> with the repository slug. Installation and activation are separate actions in the command, so omit --activate when you want the files present but inactive.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Update plugins deliberately

wp plugin update --all

This updates every installed plugin. Review wp plugin list first, confirm compatibility, make a database backup, and have a rollback plan. For lower risk, update a named plugin instead of using --all.

Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth

Deactivate a plugin during an incident

wp plugin deactivate <slug>

Use this when a plugin causes a fatal error, white screen, login failure, or conflict. If WP-CLI itself cannot load the extension, add --skip-plugins and then inspect or deactivate the suspected plugin.

Manage themes

Inspect themes and active status

wp theme list

Use the result to identify the active theme and installed alternatives before making a change.

Install, activate, and update

wp theme install <slug> --activate
wp theme update --all

The first command installs a repository theme and activates it. The second updates all installed themes. Confirm that the active theme and its child theme remain compatible, and test templates, widgets, menus, and customizations after the update.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Users, roles, and site settings

List and create users

wp user list
wp user create alice alice@example.com --role=editor

wp user list provides an account inventory. The create command makes a user with the selected role. Do not place a real password directly in a command that will be stored in shell history; use the command’s password prompt or a controlled secret workflow instead.

Change a role only with authorization

wp user update <id> --role=administrator

Replace <id> with the intended account ID. Administrator access is a high-impact change, so verify the identity and approval before running it. On multisite, network-level privileges are different from a single-site administrator role.

Inspect roles and grant network super-admin status

wp role list
wp super-admin add <login>

wp role list shows roles available on the site. wp super-admin add grants network super-admin status to a login in multisite; use it only for an authorized network administrator.

Read and change options

wp option get siteurl
wp option update blogname "New title"

Use wp option get to inspect a setting and wp option update to change it. Option values can affect URLs, branding, integrations, and serialized configuration, so capture the old value before changing production.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.

Posts, menus, taxonomies, and media

Query content in a structured format

wp post list --post_type=post --fields=ID,post_title,post_status

Limiting the post type and fields makes the output suitable for review or a script. Add the filters appropriate to your task rather than exporting every content type.

Change a post status

wp post update <id> --post_status=publish

This changes the selected post to published status. Confirm the ID and editorial approval first; the command can make content publicly visible immediately.

Inspect menus and taxonomies

wp menu list
wp taxonomy list

These commands help map navigation and classification structures during audits, migrations, and content cleanup.

Regenerate image sizes

wp media regenerate

Run this after changing registered image sizes so existing uploads receive the new derivatives. Regeneration can be time-consuming on a large media library; schedule it during a maintenance window or process it in a controlled batch where your environment supports that workflow.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Database backups, imports, and direct SQL

Export before destructive work

wp db export backup.sql

This creates a SQL dump of the WordPress database. Use a dated filename such as backup-$(date +%F).sql, store it outside the web root, and verify that the file exists and is readable before continuing.

Restore or transfer a dump

wp db import backup.sql

Importing replaces or adds data according to the SQL statements in the dump. Confirm the destination credentials and site before running it, and understand that an import can overwrite current content.

Use direct SQL sparingly

wp db query 'SELECT ...'

Direct SQL is appropriate when no WordPress command covers the operation, but it bypasses command-level safeguards. Restrict queries, test them on a copy, and take a backup first. A read-only SELECT is safer than an UPDATE or DELETE; never run destructive SQL from an unreviewed script.

Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.

Safely replace a domain or other value

wp search-replace is designed for migrations and understands PHP serialized data, so it can update URLs embedded in serialized options and metadata without corrupting their serialization. It does not change primary-key values and skips tables without a primary key.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Preview the replacement

wp search-replace 'https://staging.example.com' 'https://example.com' --all-tables --dry-run

Review the reported tables and replacement counts. Verify that the old and new values are exact, including protocol, hostname, path, and trailing-slash conventions.

Apply the replacement

wp search-replace 'old' 'new' --all-tables

Run the mutating command only after the dry-run output and backup have been checked. Limit the table set instead of using --all-tables when the migration should not touch every table.

Understand multisite scope

In multisite, the command targets the current site by default. Add --network for a network-wide operation, and use --url or an explicit site context to avoid replacing values on the wrong site. Network-wide replacements deserve a separate backup and a staged test because one mistake can affect every site.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Operational maintenance commands

Inspect and run scheduled events

wp cron event list
wp cron event run --due-now

The list command shows scheduled events and timing. The second runs events that are due immediately, which is useful when diagnosing delayed publishing, queued jobs, or a host’s disabled web cron. Running events manually can trigger external requests or heavy processing, so inspect the list first.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Clear transients and object cache

wp transient delete --all
wp cache flush

Transients are temporary stored values; deleting all of them can resolve stale settings or expired lookup problems, but it may cause expensive values to be rebuilt. wp cache flush clears the object cache when the configured cache backend supports it. Expect a temporary increase in database or application work after either operation.

Control maintenance mode

wp maintenance-mode activate
wp maintenance-mode deactivate

Activate maintenance mode for planned work that should not serve normal requests, then deactivate it as soon as validation is complete. If a failed deployment leaves the site stuck in maintenance mode, the deactivate command restores normal serving.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.

Rebuild rewrite rules

wp rewrite flush

Run this after changing permalink structures, rewrite rules, or routing-related settings. It rebuilds WordPress rewrite rules; it does not repair a web server configuration that is not passing requests to WordPress.

List sites in a network

wp site list

Use this before a multisite task to enumerate site IDs, domains, and paths. Combine it with an explicit --url when running a command for one site.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choosing the right command and scope

Task Primary command Typical scope Risk and reversibility
Inspect versions or inventory wp core version, wp plugin list, wp theme list One installation or selected site Read-only
Update software wp core update, wp plugin update, wp theme update Named component or all installed components Mutating; test and back up first
Change accounts or settings wp user, wp role, wp option Single user or site; network privileges for super-admin Can affect access or site behavior
Migrate URLs or values wp search-replace Selected tables, current site, or network Database-wide; preview and back up
Restore data wp db import Destination database Potentially overwrites current data
Repair scheduled or cached state wp cron, wp transient, wp cache Current installation or site Operational side effects; inspect first

Remote and automated administration

For a server with SSH access, prepend the remote target to a normal command:

wp --ssh=user@example.com/var/www/html plugin list

Aliases and shell scripts let you apply the same checked procedure to staging and production, but they also increase the blast radius of a mistake. Use separate aliases, require an explicit environment argument, print the resolved --path and --url before mutating commands, and keep backups and logs for each run. Managed WordPress hosting with WP-CLI, staging, SSH access, and backups can simplify this operational setup, but confirm the provider’s exact access and backup terms before relying on it.

Troubleshooting common failures

“WordPress not found” or the wrong site appears

Run the command with an explicit --path. In multisite, add --url; for a remote host, verify the SSH path and account. Check wp --info to ensure the expected PHP binary and WP-CLI runtime are being used.

A plugin or theme causes a fatal error

Retry the inventory or deactivation command with --skip-plugins or --skip-themes. Deactivate the suspected extension, inspect logs, and re-enable it only after compatibility is confirmed.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The site still shows old values after a change

Check the option or database value, then clear relevant transients or the object cache. If URLs or permalinks changed, run wp rewrite flush. A reverse proxy, CDN, or browser cache may require separate invalidation outside WP-CLI.

A search-and-replace changed too much

Stop further writes, preserve the output and backup, and restore the database only after confirming the backup is complete and matches the intended site. On multisite, review whether --network was used and whether the command ran under the intended --url.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.