Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
VGSources
Blog

Essential WP-CLI Commands Every WordPress Admin Should Know

A practical, safety-first reference to the WP-CLI commands WordPress administrators use for core updates, plugins, themes, users, content, backups, search-replace migrations, cron, caches, maintenance mode, rewrites, and multisite.
Length11 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

WP-CLI is WordPress’s official command-line interface. It lets you administer a site from a shell, repeat the same operation across installations, and put routine work into scripts, cron jobs, or deployment pipelines. The essential commands cover core updates, plugins, themes, users, content, backups, migrations, scheduled tasks, caches, and multisite administration.

The safest way to use WP-CLI is to treat every command as a targeted operation: identify the installation, confirm the user and scope, read the command’s help, back up before changing data, and use a dry run whenever one is available.

As an Amazon Associate I earn from qualifying purchases.

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.

What WP-CLI does and why targeting matters

WP-CLI commands execute against a particular WordPress installation. A shell prompt alone does not tell you which site a command will modify, so make the target explicit whenever there is any possibility of ambiguity.

  • --path points WP-CLI at a specific WordPress directory.
  • --url selects a site, which is especially important in a multisite installation.
  • --user supplies the WordPress user context for commands that need one.
  • --ssh runs a command on a remote server when SSH is configured.
  • --alias lets a configured alias represent a site or group of sites.

Other global parameters include --http, --skip-plugins, --skip-themes, --require, --exec, --debug, and --prompt. Use skip flags when a broken extension prevents WordPress from loading, and use --debug when you need diagnostic output.

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.

Verify the runtime and installation

Start with environment and version checks:

wp --info
wp --path=/var/www/html core version
wp --url=https://example.com site info
wp [email protected]/var/www/html plugin list

wp --info shows the WP-CLI runtime and environment. core version confirms which WordPress release is installed at the supplied path. In a network, site info confirms the site selected by the URL. The SSH form avoids accidentally running a local command against the wrong server.

Read command-specific help

WP-CLI’s built-in help is the fastest way to confirm syntax, available flags, and examples for the installed version:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
wp help <command>
wp help plugin update
wp help search-replace

Read the help immediately before unfamiliar or destructive work. Flags and subcommands can vary by WP-CLI and WordPress version.

A safe operating sequence for changes

Use this sequence for updates, imports, replacements, and other mutating operations:

  1. Confirm the target. Specify --path, --url, an alias, or --ssh; add --user when the command depends on a WordPress account.
  2. Inspect the environment. Run wp --info, check wp core version, and use read-only list or status commands to understand the current state.
  3. Read the help. Run wp help <command> and note scope flags such as --network, table selectors, and dry-run options.
  4. Create a database backup. For example, wp db export backup-$(date +%F).sql. Store the dump where it will not be overwritten by the operation.
  5. Preview where possible. Prefer --dry-run, especially for search-and-replace operations.
  6. Keep the scope narrow. Name a plugin slug, user ID, site URL, or table set instead of starting with a network-wide or all-tables flag.
  7. Test in staging first. If staging is available, perform the change there, check the site and logs, then schedule production work.
  8. Protect credentials. Do not put passwords, API keys, or database secrets in shell history or committed scripts. Use interactive prompts, controlled environment variables, or a secret manager.
  9. Keep a recovery path. Retain the SQL dump, know how to run wp db import, and record the exact command used.

Core WordPress commands

The wp core command family handles version checks, upgrades, database migrations, and file integrity checks.

Command Purpose Effect
wp core version Display the installed WordPress version. Read-only
wp core check-update Check whether a core update is available. Read-only
wp core update Download and install a WordPress core update. Mutating
wp core update-db Run pending database updates after a core change. Mutating
wp core verify-checksums Compare core files with official checksums when supported for the installed release. Read-only

A conservative update sequence is:

wp --path=/var/www/html core check-update
wp --path=/var/www/html db export backup-$(date +%F).sql
wp --path=/var/www/html core update
wp --path=/var/www/html core update-db
wp --path=/var/www/html core verify-checksums

Run the database step when the update reports pending migrations. Checksum verification is useful for detecting unexpected changes to WordPress core files, but it does not audit plugin or theme files.

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.

Plugin administration

List and inspect installed plugins

wp plugin list

The list includes installed plugins and their status, allowing you to identify active, inactive, or unexpectedly installed extensions before an update or troubleshooting session.

Install and activate a plugin

wp plugin install <slug> --activate

This installs a plugin from the WordPress repository when the slug is valid and activates it immediately. Confirm the plugin’s compatibility and licensing requirements before activating it on production.

Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed

Update plugins deliberately

wp plugin update --all

Updating every installed plugin is convenient but broad. Review wp plugin list first, make a backup, and have a rollback plan. For a controlled update, use the specific plugin slug rather than --all and update one extension at a time while monitoring the site.

Deactivate a plugin during troubleshooting

wp plugin deactivate <slug>

Deactivation is reversible and leaves the plugin files in place. It is a useful first isolation step for a fatal error, broken editor, or unexpected front-end behavior. If WordPress cannot load the plugin, add --skip-plugins to the command that must bootstrap the site.

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

Theme commands

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

wp theme list shows installed themes and which one is active. Installing with --activate changes the active theme, so use it only when the replacement has been tested. The all-themes update command has the same compatibility and rollback considerations as a bulk plugin update. A child theme or custom theme should be included in your staging test because its templates and hooks can depend on a particular parent or core version.

Users, roles, and site settings

List and create users

wp user list
wp user create alice [email protected] --role=editor

The create command assigns the selected role. Do not place a real password directly in a command line: shell history and process listings can expose it. Use a secure password workflow supported by your environment, then deliver credentials through an approved channel.

Change a user’s role

wp user update <id> --role=administrator

Changing a role affects what the account can do across the site. Restrict this operation to an authorized administrator, verify the numeric user ID first, and avoid granting administrator privileges merely to solve a temporary task.

Inspect roles and network administrators

wp role list
wp super-admin add <login>

wp role list displays roles available on the site. In multisite, wp super-admin add grants network-level authority to the specified login, which is substantially broader than a site administrator role. Use it only for a documented network administration need.

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

Read and update 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 changes can affect URLs, branding, integrations, and serialized values, so export the database before changing critical settings and verify the result in the browser.

Posts, menus, taxonomies, and media

Inspect posts in a script-friendly format

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

Limiting the fields produces compact output that is easier to review or pipe into another shell command. Add a status or date filter when you need to audit only a subset.

Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)

Change a post’s status

wp post update <id> --post_status=publish

Publishing is an immediate content change. Verify the post ID, editorial approval, author, and scheduled timing before running it against production.

Regenerate image sizes

wp media regenerate

Run this after changing registered image sizes so existing uploads receive the new derivatives. It can process many files and consume CPU and storage; schedule it during a quiet period and watch for disk-space or timeout problems.

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

Inspect navigation and taxonomies

wp menu list
wp taxonomy list

These read-only commands help inventory navigation menus and taxonomies before a redesign, migration, or content cleanup.

Database backups, imports, and SQL

Export before destructive work

wp db export backup.sql

The export creates a SQL dump of the WordPress database. Use a dated filename such as backup-$(date +%F).sql, confirm that the command completed, and place the dump in protected storage. A database export does not include uploaded media or other files, so pair it with a file-level backup when the operation can alter the filesystem.

Restore or transfer a database

wp db import backup.sql

Importing replaces or merges database content according to the dump and the database state. Confirm the target path, database credentials, table prefix, and maintenance plan first. On a staging copy, verify URLs, users, plugins, and content before treating the import as successful.

Use direct SQL only when needed

wp db query 'SELECT ...'

Direct SQL is powerful but bypasses the guardrails and abstractions of command-specific operations. Use it for a clearly understood query, take a backup first when data may change, and test the statement on staging. Prefer a read-only SELECT while investigating.

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

Safe domain and data replacement with wp search-replace

wp search-replace is designed for migrations and understands PHP serialized data, which is important because a raw text replacement can corrupt serialized option or metadata values. It does not change primary-key values and skips tables without a primary key.

Preview a domain migration

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

Review the dry-run counts and table scope before applying anything. Confirm that the old and new schemes, hostnames, and trailing-slash conventions match the migration you actually intend.

Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC

Apply the replacement

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

Run the live command only after exporting the database and checking the preview. Broad strings can alter unrelated data, so use precise old and new values and limit the table set when possible.

Multisite scope

In multisite, the command targets the current site by default. Add --network only when a network-wide replacement is intended:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
wp search-replace 'old' 'new' --all-tables --network

Use wp --url=https://example.com to select a site for a site-specific operation, and enumerate the network with wp site list before planning a multi-site migration.

Scheduled tasks, caches, and maintenance

Inspect and run cron events

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

The list command shows scheduled events and their timing. Running due events is useful for diagnosing a queue that is not being processed, but it may trigger emails, imports, publishing actions, or other jobs immediately. Run it with the same care as a production deployment.

Clear transients and object cache

wp transient delete --all
wp cache flush

Deleting all transients removes temporary option values and can force plugins to rebuild cached data. Flushing the object cache clears in-memory or persistent cache entries when the configured backend supports it. These commands can increase database or application load immediately afterward, so use them during a controlled maintenance window.

Control maintenance mode

wp maintenance-mode activate
wp maintenance-mode deactivate

Activate maintenance mode before planned work that could leave visitors seeing an inconsistent state, then deactivate it as soon as validation is complete. If a failed deployment leaves the site stuck in maintenance mode, the deactivate command is a direct recovery step.

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

Rebuild rewrite rules

wp rewrite flush

Flush rewrite rules after changing permalink structures or rewrite-related configuration. If the site still returns 404 errors, also verify the web server’s rewrite configuration and the WordPress home and site URLs; flushing alone cannot repair an incorrectly configured server.

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

Choosing the right command and scope

Task Primary command Typical scope Risk profile
Check versions or inventory core version, plugin list, theme list, site list One installation or selected network Read-only
Update software core update, plugin update, theme update Core, named extension, or all installed extensions Filesystem and compatibility risk
Change accounts user create, user update, super-admin add One user or the whole network Permission and security risk
Change content post update, media regenerate Named post or media library Editorial and resource risk
Migrate data db export, db import, search-replace Database, selected tables, current site, or network High database risk; back up first
Repair operations cron, transient, cache, rewrite, maintenance-mode Scheduled jobs, caches, rewrites, or visitor access Operational side effects

The key decisions are target scope, reversibility, affected data, automation value, and required access. Read-only commands are safest for discovery; dry runs provide a preview; mutating commands require a tested recovery plan.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.

Automation patterns that remain safe

WP-CLI becomes especially valuable when a repeatable sequence is written as a reviewed shell script or deployment step. Keep each operation explicit rather than hiding broad flags behind a generic wrapper. A maintenance script might:

  1. Set a fixed WordPress path and, for multisite, a fixed URL.
  2. Check the core version and list active plugins.
  3. Export a dated database backup.
  4. Activate maintenance mode.
  5. Run the narrowly scoped update or migration.
  6. Flush rewrites or caches only if the change requires it.
  7. Run a smoke check, inspect logs, and deactivate maintenance mode.

Use exit codes and logging so an interrupted command stops the sequence instead of continuing into a partially updated site. Keep scripts out of public web directories, restrict their permissions, and review any variable that can alter a path, URL, table list, or user ID.

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

Common failure modes and recovery

“Error: This does not seem to be a WordPress installation.”

The path is wrong or points above or below the WordPress root. Locate the directory containing wp-config.php and rerun the command with --path=/correct/path.

A plugin prevents bootstrap

Use --skip-plugins for the recovery command, list the plugins, and deactivate the suspected slug. Do not leave the site in a permanently skipped state; fix or remove the incompatible extension and then test normal loading.

The command modified the wrong site

Stop further changes, record the exact command, and restore from the verified SQL export if necessary. For future runs, require an explicit --path, --url, alias, or SSH target in scripts rather than relying on the shell’s current directory.

A migration produces broken URLs

Check the dry-run output, URL scheme, hostname, and table scope. Restore the pre-migration dump if the replacement was incorrect, correct the values, and rerun the operation with a narrower scope. Serialized data should be handled by wp search-replace, not an unstructured text editor.

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

A command appears to hang or times out

Large plugin updates, media regeneration, imports, and network-wide replacements can be resource-intensive. Run them from SSH, split the work into smaller scopes, schedule it during low traffic, and monitor memory, CPU, disk space, database locks, and PHP or web-server logs.

Essential command checklist

  • wp --info and wp help <command> for orientation.
  • wp core version, core check-update, core update, core update-db, and core verify-checksums for WordPress itself.
  • wp plugin list, plugin install, plugin update, and plugin deactivate for extensions.
  • wp theme list, theme install, and theme update for themes.
  • wp user list, user create, user update, role list, and super-admin add for accounts.
  • wp option get, option update, post list, post update, media regenerate, menu list, and taxonomy list for administration.
  • wp db export, db import, db query, and carefully scoped search-replace for database work.
  • wp cron, transient delete, cache flush, maintenance-mode, rewrite flush, and site list for operations and multisite.

These commands cover the high-value work most administrators perform in wp-admin, while making the same work auditable and repeatable from a terminal. Target deliberately, back up before mutation, preview broad operations, and keep a tested restore path before automating production changes.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.