Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk9 min

Essential WP-CLI Commands Every WordPress Admin Should Know

A practical, safety-first guide to WP-CLI commands for targeting sites, updating WordPress, managing plugins and users, backing up databases, migrating domains, and automating maintenance.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

WP-CLI lets you administer WordPress from a terminal instead of clicking through wp-admin. The essential workflow is: identify the correct installation, inspect what will change, make a database backup, run the narrowest command that solves the task, and verify the result. With that discipline, you can update core, plugins, and themes; manage users, options, posts, and media; migrate domains safely; and automate recurring maintenance.

What WP-CLI is and why targeting matters

WP-CLI is WordPress’s command-line interface. Its commands load a WordPress installation and invoke the same kinds of administrative operations available in the dashboard, but in a form that can be repeated in shell scripts, cron jobs, deployment pipelines, or remote sessions. The command acts on the installation it loads, so a syntactically correct command can still damage the wrong site if its target is ambiguous.

As an Amazon Associate I earn from qualifying purchases.

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

Verify the runtime and installation

  • wp --info shows the WP-CLI runtime, PHP details, and environment information.
  • wp --path=/var/www/html core version runs against the installation at an explicit filesystem path.
  • wp --url=https://example.com site info selects a site when working in a multisite context.
  • wp [email protected]/var/www/html plugin list runs a command on a remote installation when SSH is configured.

Other global parameters include --user to select a WordPress user context, --alias for configured groups of environments, --skip-plugins and --skip-themes to avoid loading extensions during troubleshooting, and --debug, --prompt, --require, --exec, and --http for specialized workflows. Confirm the path, URL, and account before every mutating command, especially when your shell history contains several staging and production environments.

Read command-specific help

Use wp help <command> before an unfamiliar operation. For example, wp help search-replace displays its accepted arguments, flags, and examples. Help is also useful for checking whether a command supports a preview mode or a network-wide scope.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

A safe operating sequence for changes

  1. Identify the target. Add --path, --url, an alias, or --ssh rather than relying on the current directory. Add --user when permissions or auditability require a particular account.
  2. Inspect versions and available updates. Run wp --info, then the relevant list or check command. Do not begin with a broad update if you have not seen what is installed.
  3. Back up the database. Before imports, replacements, role changes, or updates, create a dated SQL dump: wp db export backup-$(date +%F).sql.
  4. Preview where possible. Use --dry-run for commands that support it, most importantly wp search-replace.
  5. Use an explicit scope. Name a plugin slug, table set, site URL, or --network only when you really intend a network-wide operation.
  6. Test and monitor. Run changes in staging first when available. Afterward, check the front end, login, critical forms, scheduled jobs, PHP logs, and hosting health monitors.
  7. Protect credentials. Do not put database passwords, API keys, or user passwords directly in commands that will be saved in shell history. Prefer an interactive prompt, environment controls, or a secrets manager.

WordPress core commands

The wp core command family covers version checks, updates, database migrations associated with a core release, and file-integrity checks.

Command Purpose Change type
wp core version Print the installed WordPress version. Read-only
wp core check-update Check whether a newer core release is available. Read-only
wp core update Download and install the selected WordPress core update. Filesystem change
wp core update-db Run pending database upgrades after a core change. Database change
wp core verify-checksums Compare core files with official checksums when the installed release supports checksum verification. Read-only

A cautious update sequence is wp core check-update, a database export, wp core update, and then wp core update-db if pending migrations are reported. Keep a rollback plan for the database and files; a core update can expose incompatibilities in old plugins or themes even when the command itself succeeds.

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

Plugin and theme administration

Inspect before changing

  • wp plugin list lists installed plugins and indicates their status.
  • wp theme list lists installed themes and identifies the active theme.

Capture these lists before a maintenance window so you can compare the post-change state. On a production site, review compatibility and have a way to restore the previous version before updating everything at once.

Install, activate, update, and deactivate plugins

  • wp plugin install <slug> --activate installs a plugin from the configured repository and activates it.
  • wp plugin update --all updates every installed plugin. Review wp plugin list first and avoid this broad flag when you need a controlled, one-plugin-at-a-time rollout.
  • wp plugin deactivate <slug> disables a plugin while troubleshooting a fatal error, conflict, or unexpected behavior.

Replace <slug> with the actual repository slug, not the display name. If WordPress cannot bootstrap because an extension is broken, add --skip-plugins to diagnostic commands and deactivate the offending plugin once the installation loads reliably.

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

Install and update themes

  • wp theme install <slug> --activate installs a theme and makes it active.
  • wp theme update --all updates all installed themes after compatibility checks.

Activating a theme is an immediate front-end change. Confirm that the theme is appropriate for the site and that a fallback theme remains available before using --activate on production.

Users, roles, and site settings

List and create users

  • wp user list displays the site’s users.
  • wp user create alice [email protected] --role=editor creates a user with the chosen role.
  • wp user update <id> --role=administrator changes an existing user’s role.
  • wp role list shows roles registered on the installation.

Use a secure password workflow rather than placing a password in the command line, where it may be visible in shell history or process listings. Grant administrator privileges only when authorized, and verify the numeric user ID before changing a role.

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.

Read and change options

  • wp option get siteurl reads the site’s configured URL.
  • wp option update blogname "New title" changes the displayed site title.

Option changes are immediate. Read the current value first and quote values containing spaces or shell metacharacters.

Multisite super administrators

On multisite, wp super-admin add <login> grants network super-admin status to the specified login. Treat this as a network-level security change, not an ordinary site-role edit, and confirm that the account and network are correct.

Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by

Posts, menus, taxonomies, and media

Inspect and publish content

wp post list --post_type=post --fields=ID,post_title,post_status returns a compact, structured list of posts. Once you have confirmed the ID, wp post update <id> --post_status=publish changes that post’s status to published. Use the ID and status output to avoid editing the wrong item.

Inspect navigation and taxonomies

  • wp menu list lists registered navigation menus.
  • wp taxonomy list lists taxonomies available to the installation.

Regenerate image sizes

wp media regenerate recreates image derivatives after registered image sizes change. It can process a large media library, so run it during a maintenance window or use the command’s available selection options from wp help media regenerate. Ensure sufficient disk space before starting.

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

Database backups, restores, and direct SQL

Export before destructive work

wp db export backup.sql creates a SQL dump of the WordPress database. A dated filename such as backup-$(date +%F).sql makes the artifact easier to identify. Store the dump somewhere separate from the live database and verify that it was created before proceeding.

Restore or transfer a dump

wp db import backup.sql imports a SQL dump into the selected installation. Confirm the target path and database credentials first: importing into the wrong site can overwrite its content. After an import, check the site’s URL, login, permalinks, media references, and scheduled events.

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.

Use direct queries sparingly

wp db query 'SELECT ...' runs SQL directly. Use it only when a WordPress command family does not provide the needed operation. A direct query bypasses the safety and data-model awareness of higher-level commands; take a backup, test the query on a copy, and make mutating SQL as narrow as possible.

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

Safe domain and URL replacement with wp search-replace

Domain migrations require more than changing the visible site title. URLs can appear in options, post content, metadata, and plugin tables. WP-CLI’s wp search-replace command is designed for this work and intelligently handles PHP serialized data, which helps preserve serialized strings when their lengths change. 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

The example searches all eligible tables and reports what would change without writing data. Review the table scope and counts, and check for environment-specific values that should not be replaced.

Apply only after the preview

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

Run the mutating command only after confirming the dry-run output and completing a database export. Keep the old dump until the live site has been tested.

Understand multisite scope

In multisite, search-replace targets the current site by default. Add --network only when you intentionally want a network-wide operation. Use wp site list to enumerate network sites and decide whether each site needs the replacement. A network-wide replacement can affect tables and URLs that are unrelated to the site you are currently viewing.

Operational maintenance commands

Scheduled events and cron

  • wp cron event list lists scheduled events, their hooks, and timing.
  • wp cron event run --due-now runs events that are currently due.

Use the list command to identify a stuck or overdue hook before forcing execution. Running due events manually can trigger email, imports, backups, or other side effects immediately.

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

Transients and object cache

  • wp transient delete --all deletes stored transients, useful when diagnosing stale cached values.
  • wp cache flush flushes the object cache when the configured cache backend supports it.

Clearing transients or flushing the object cache may cause a temporary increase in database queries and page-generation time while values are rebuilt. Do it as a diagnostic step, not as a routine substitute for fixing an underlying cache or application problem.

Maintenance mode and rewrite rules

  • wp maintenance-mode activate enables maintenance mode during planned work.
  • wp maintenance-mode deactivate restores normal access.
  • wp rewrite flush rebuilds rewrite rules after permalink or rewrite configuration changes.

Always deactivate maintenance mode after a successful operation, including after a failed script that left the site locked. Flush rewrites after changing permalink structures or registering rewrite rules; it is not necessary after every ordinary content edit.

Turning commands into repeatable automation

WP-CLI’s value increases when a tested sequence becomes a script or deployment step. Put the target path or alias near the top of the script, stop on errors, log command output, and require an explicit production confirmation before mutating operations. Separate read-only discovery from changes: first collect versions, plugin status, database backup location, and site URLs; then run the approved commands.

For recurring work, cron can invoke a narrowly scoped command such as a due-event check or a report. Avoid embedding secrets in the script. Use the hosting environment’s secret store or an interactive prompt, and restrict the shell account and SSH key to the least privilege needed.

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

Common failure modes and recovery

  • Wrong site changed: stop immediately, identify the correct path or URL, and restore the pre-change database dump if data was modified.
  • Command cannot load WordPress: rerun a diagnostic command with --skip-plugins --skip-themes, then inspect the extension or theme that prevents bootstrap.
  • Update creates a compatibility problem: place the site in maintenance mode if necessary, use the documented rollback plan, and restore the database or previous files rather than repeatedly applying untested updates.
  • Search-replace missed data: check whether the affected tables were included, whether the command ran for the current site only, and whether a deliberate --network scope is required.
  • Permalinks return 404 errors: run wp rewrite flush, then test representative posts, pages, and feeds.
  • Scheduled work remains stale: inspect wp cron event list before using wp cron event run --due-now; determine whether the server’s cron trigger or the callback itself is failing.

A compact command checklist

Need Command Risk profile
Inspect environment wp --info Read-only
Confirm WordPress version wp core version Read-only
Back up database wp db export backup.sql Creates a backup file
Update core wp core update Filesystem change
Install a plugin wp plugin install <slug> --activate Filesystem and site behavior change
Deactivate a plugin wp plugin deactivate <slug> Site behavior change
Create a user wp user create alice [email protected] --role=editor Account change
Change an option wp option update blogname "New title" Configuration change
Preview a URL migration wp search-replace 'old' 'new' --all-tables --dry-run Read-only preview
Run due cron events wp cron event run --due-now Triggers scheduled side effects
Rebuild permalinks wp rewrite flush Rewrites configuration

Bottom line

Master the targeting flags, backup and dry-run workflow first. Then the core, plugin, theme, user, db, and search-replace command families cover most administration tasks, while cron, cache, transients, maintenance mode, and rewrites keep routine operations scriptable and recoverable.

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 *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.