Plans & Getting Started

How to Use WP-CLI

By the StarDomain teamPublished 2 min read
Knowledge base article
Contents (4 sections)

WP-CLI is the command-line tool for WordPress. With it you can update plugins, reset a password or search and replace across the database without opening wp-admin.

Key takeaways

You need a shell to run WP-CLI. On Container Hosting, open the Terminal tab in your container panel. On DirectAdmin hosting, ask support to enable SSH (a jailed shell) first. On a VPS, install WP-CLI yourself.

1. Where you can run it

ProductWP-CLI
DirectAdmin hostingOver SSH, after support enables SSH for your account (open a ticket)
VPSInstall it yourself (see wp-cli.org), then run it over SSH
Container HostingIn the browser Terminal tab (confirm your password or 2FA to open it)

2. Getting started on DirectAdmin hosting

  1. Ask for SSH.
    Open a ticket and ask support to enable SSH on your hosting account.
  2. Connect.
    ssh yourusername@your-server-hostname
  3. Go to your site folder.
    cd ~/domains/yourdomain.com/public_html
  4. Check it works.
    wp --info. If the command is not found, tell support on the same ticket.

3. Useful commands

bash
wp core version                 # WordPress version
wp core update                  # update WordPress
wp plugin list                  # list plugins
wp plugin update --all          # update all plugins
wp plugin deactivate --all      # turn off every plugin (white-screen fix)
wp theme update --all           # update all themes
wp user list                    # list users
wp user update 1 --user_pass='NewStrongPassword'   # reset a password
wp search-replace 'https://old.example' 'https://new.example' --dry-run
wp cache flush                  # flush the object cache
wp cron event list              # scheduled tasks

Run search-replace with --dry-run first, and take a backup before changing the database.

4. Getting started on Container Hosting

  1. Open the Terminal tab
    in your container panel and confirm your password or 2FA code.
  2. Go to your site folder.
    cd ~/public_html
  3. Check it works.
    wp --info. If the command is not found, open a ticket.

Take a backup with Back up now on the Backups tab before you change the database.

Where can I run WP-CLI on StarDomain?

In the Terminal tab on Container Hosting, over SSH on DirectAdmin hosting (enabled on request), or on a VPS.

How do I fix a white screen without WP-CLI?

Check the error log (the Logs tab on Container Hosting), then rename the suspect plugin's folder in wp-content/plugins to turn it off.

Was this article helpful?

Your answer helps us decide what to improve next.

Still need help? Open a support ticket and our team will reply.

Prefer an app? Add this site to your home screen.Get the app