Nội dung
There are some cases when you try to log in to WordPress admin but get redirected from the wp-login.php page to the homepage, the reason is that your user has lost admin rights. And in this article, AZDIGI will guide you through updating user permissions using WordPress CLI that has been deployed on all hosting servers at AZDIGI.
To do this, you can follow the steps below.
Step 1: Access Terminal in cPanel
Step 2: Access the website that needs to regain admin rights
If your hosting has many websites, you need to identify the exact website and access it, enter the ll command to list all your websites.
ll
For example, the admin user of the linuxcanban.com website has lost the permission. I will access that folder with the command
cd linuxcanban.com
You need to access the directory containing the website to regain the rights, you must rely on the wp-config.php file to determine the correct database and user to update.
Step 3: Update permissions for user
After accessing the directory containing the website, enter the wp user list command to display a list of users with the corresponding ID.
wp user list
After entering the command, the system will display the User login, ID and Roles. At this point, you need to determine the ID of the User need to regain the admin right.
For example, I need to regain permissions for the user who is admin and has ID = 1. I will execute the following command
wp user update 1 --role=administrator
And the system shows the message Success is you can log in already.
- Hotline 247: 028 888 24768 (Ext 0)
- Ticket/Email: You can use your email to register for the service and send it directly to: support@azdigi.com
- Click on the AZDIGI website to refer to the best Hosting/VPS service in Vietnam.
There are some cases when you try to log in to WordPress admin but get redirected from the wp-login.php page to the homepage, the reason is that your user has lost admin rights. And in this article, AZDIGI will guide you through updating user permissions using WordPress CLI that has been deployed on all hosting servers at AZDIGI.
To do this, you can follow the steps below.
Step 1: Access Terminal in cPanel
Step 2: Access the website that needs to regain admin rights
If your hosting has many websites, you need to identify the exact website and access it, enter the ll command to list all your websites.
ll
For example, the admin user of the linuxcanban.com website has lost the permission. I will access that folder with the command
cd linuxcanban.com
You need to access the directory containing the website to regain the rights, you must rely on the wp-config.php file to determine the correct database and user to update.
Step 3: Update permissions for user
After accessing the directory containing the website, enter the wp user list command to display a list of users with the corresponding ID.
wp user list
After entering the command, the system will display the User login, ID and Roles. At this point, you need to determine the ID of the User need to regain the admin right.
For example, I need to regain permissions for the user who is admin and has ID = 1. I will execute the following command
wp user update 1 --role=administrator
And the system shows the message Success is you can log in already.
Wishing you success!