Traducciones al Español
Estamos traduciendo nuestros guías y tutoriales al Español. Es posible que usted esté viendo una traducción generada automáticamente. Estamos trabajando con traductores profesionales para verificar las traducciones de nuestro sitio web. Este proyecto es un trabajo en curso.
For a limited time:  Create a SiteBay account and WordPress Site
to try this guide for free.

Basic WP-CLI Commands

When managing a WordPress site, using the command line can make tasks quicker and easier. WP-CLI, or WordPress Command Line Interface, is a powerful tool that helps you manage your WordPress sites without using the web browser. Whether you’re looking to add a new user, change your password, or install plugins, here’s how you can do it using WP-CLI.

Code Server

Go to your My SiteBay site’s dashboard to try these out

If you aren’t on SiteBay, you need to install wp-cli first on your local machine

Installation (Non SiteBay Users)

Make sure you have it installed on your local development machine or hosting environment. You can install WP-CLI by following the instructions on the official website. (This is preinstalled on SiteBay Code Server)

Adding or Changing a User

Adding a New User

To add a new user to your WordPress site via WP-CLI, you can use the following command:

1
wp user create <username> <email> --role=<role>
  • Replace <username> with the desired username.
  • Replace <email> with the user’s email address.
  • Replace <role> with the appropriate user role (e.g., administrator, editor, subscriber).

Example:

1
wp user create juan [email protected] --role=editor

Changing a User’s Role

If you need to change a user’s role, use this command:

1
wp user set-role <username> <role>
  • Replace <username> with the username of the user.
  • Replace <role> with the new role.

Example:

1
wp user set-role juan contributor

Changing Your Password

If you’ve forgotten your password or need to update it for security reasons, WP-CLI makes it simple.

1
wp user update <username> --user_pass=<newpassword>
  • Replace <username> with your username.
  • Replace <newpassword> with your new password.

Example:

1
wp user update juan --user_pass=newstrongpassword

Installing Plugins

Installing plugins using WP-CLI is straightforward and can be faster than using the WordPress dashboard.

Install a Plugin

To install a plugin, you need to know its slug from the WordPress plugin repository.

1
wp plugin install <plugin_slug>
  • Replace <plugin_slug> with the slug of the plugin.

Example:

1
wp plugin install akismet

Activate a Plugin

After installing, you need to activate the plugin:

1
wp plugin activate <plugin_slug>

Example:

1
wp plugin activate akismet

Summary

Learning the basics of WP-CLI can greatly reduce the time you spend managing your WordPress site. It gives you the ability to perform critical tasks directly from the command line—whether you’re managing users, changing passwords, or handling plugins. It’s a tool that, once mastered, can offer you a straightforward and efficient way to manage your site’s back-end.

This page was originally published on


Join the conversation.
Read other comments or post your own below. Comments must be respectful, constructive, and relevant to the topic of the tutorial. Do not post external links or advertisements. Before posting, consider if your comment would be better addressed by contacting our Support team or asking on our Community Site.
The commenting system for SiteBay Docs requires the acceptance of Functional Cookies, which allow us to analyze site usage so we can measure and improve performance. To view and create comments for this article, please update your Cookie Preferences on this website and refresh this web page. Please note: You must have JavaScript enabled in your browser.