To list all the commands write “wp help” or just “wp”.
In this post, we will cover use cases where you need to edit or create a new admin account.
As root in SSH run:
Download wp-cli:
Code: Select all
wget -nv https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -O /usr/local/bin/wp
chmod +x /usr/local/bin/wp
Code: Select all
USER='SomeMyVestaUser'
cd /home/SomeMyVestaUser/web/domain.com/public_html/
Code: Select all
sudo -H -u$USER wp user list --role=administrator
Code: Select all
# +----+------------+--------------+-----------------+---------------------+---------------+
# | ID | user_login | display_name | user_email | user_registered | roles |
# +----+------------+--------------+-----------------+---------------------+---------------+
# | 1 | admin | admin | [email protected] | 2022-07-07 08:47:16 | administrator |
# +----+------------+--------------+-----------------+---------------------+---------------+
Code: Select all
sudo -H -u$USER wp user update admin --user_pass="HfrhnbAdQCOzHxpK"
Code: Select all
sudo -H -u$USER wp user create 'mynewadmin' '[email protected]' --role=administrator --user_pass=HfrhnbAdQCOzHxpK