{"id":2361,"date":"2019-07-24T11:55:12","date_gmt":"2019-07-24T11:55:12","guid":{"rendered":"https:\/\/chemicloud.com\/kb\/?post_type=ht_kb&#038;p=2361"},"modified":"2024-10-16T09:42:05","modified_gmt":"2024-10-16T09:42:05","slug":"sorry-you-are-not-allowed-to-access-this-page-wordpress","status":"publish","type":"ht_kb","link":"https:\/\/chemicloud.com\/kb\/article\/sorry-you-are-not-allowed-to-access-this-page-wordpress\/","title":{"rendered":"\u201cSorry, You Are Not Allowed to Access This Page\u201d Error in WordPress? Here&#8217;s How to Fix It!"},"content":{"rendered":"<p>While trying to access your WordPress admin panel, you may be encountering the \u201cSorry, you are not allowed to access this page\u201d error. This error will be preventing you from accessing your dashboard and making important changes to your site.<\/p>\n<h3 id=\"what-causes-the-sorry-you-are-not-allowed-to-access-this-page-error\">What Causes the \u201cSorry, You Are Not Allowed to Access This Page\u201d Error<\/h3>\n<p>Fundamentally, this error occurs as a result of a username role issue. To be more specific, the username that you were using to access your WordPress dashboard, doesn&#8217;t have an administrator role.<\/p>\n<h3 id=\"how-to-fix-the-sorry-you-are-not-allowed-to-access-this-page-error-for-wordpress-dashboard\">How to Fix the \u201cSorry, You Are Not Allowed to Access This Page\u201d Error for WordPress Dashboard<\/h3>\n    \t\t<div class=\"hts-messages hts-messages--danger   hts-messages--withicon \"   >\r\n    \t\t\t    \t\t\t    \t\t\t\t<p>\r\n    \t\t\t\t\tBefore going further, it\u2019s highly recommended that you back up your WordPress database. This will ensure that you can easily restore your database in case something goes wrong while troubleshooting this issue.\u00a0    \t\t\t\t<\/p>\r\n    \t\t\t    \t\t\t\r\n    \t\t<\/div><!-- \/.ht-shortcodes-messages -->\r\n    \t\t\n<p>In order to fix the aforementioned error, you&#8217;ll need to set an administrator role to your WordPress admin panel username. You can easily do so using phpMyAdmin or <a href=\"https:\/\/chemicloud.com\/blog\/wp-cli\/\" target=\"_blank\" rel=\"noopener\">WP-CLI<\/a>, which is the command-line interface for WordPress. We&#8217;ll explore both options.<\/p>\n<p class=\"p1\"><b>Struggling with WordPress troubleshooting? ChemiCloud is the hosting solution designed to save you time and money! <\/b><span class=\"s1\">\ud83e\udd13<\/span><b> Try our <\/b><a href=\"https:\/\/chemicloud.com\/managed-wordpress-hosting?utm_source=kb&amp;utm_medium=article#60b65e4e63b58\"><b>Managed WordPress Hosting<\/b><\/a><b> plans for just $1!<\/b><\/p>\n<h4 id=\"how-to-change-wordpress-user-roles-in-mysql-database-using-phpmyadmin\">How to change WordPress user roles in MySQL database using PhpMyAdmin?<\/h4>\n<p>We&#8217;ll assume that you&#8217;re already logged into your phpMyAdmin.<\/p>\n<p><strong>1)<\/strong> You&#8217;ll have to locate first the ID number for your WordPress admin username. Open the wp_users or xxx_users table in the database as highlighted. (wp_ is just the prefix, your table prefix may be different)<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2363\" src=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2019\/07\/WordPress-users-table-phpMyAdmin.png\" alt=\"\" width=\"2880\" height=\"1060\" srcset=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2019\/07\/WordPress-users-table-phpMyAdmin.png 2880w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2019\/07\/WordPress-users-table-phpMyAdmin-300x110.png 300w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2019\/07\/WordPress-users-table-phpMyAdmin-768x283.png 768w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2019\/07\/WordPress-users-table-phpMyAdmin-1024x377.png 1024w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2019\/07\/WordPress-users-table-phpMyAdmin-50x18.png 50w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2019\/07\/WordPress-users-table-phpMyAdmin-60x22.png 60w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2019\/07\/WordPress-users-table-phpMyAdmin-100x37.png 100w\" sizes=\"auto, (max-width: 2880px) 100vw, 2880px\" \/><\/p>\n<p><strong>2)<\/strong> Once you&#8217;ll open the wp_users table, you will see a list with the existing usernames which are created on your WordPress site. Locate the username that you were using to log in as an admin and look up after the ID. In our case, the ID is &#8220;1&#8221; as can be seen in the screenshot below.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2364\" src=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2019\/07\/dc2de93c47bd6bce012421eba031d890_Image202019-07-2420at202.34.0920PM.png\" alt=\"\" width=\"2393\" height=\"457\" srcset=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2019\/07\/dc2de93c47bd6bce012421eba031d890_Image202019-07-2420at202.34.0920PM.png 2393w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2019\/07\/dc2de93c47bd6bce012421eba031d890_Image202019-07-2420at202.34.0920PM-300x57.png 300w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2019\/07\/dc2de93c47bd6bce012421eba031d890_Image202019-07-2420at202.34.0920PM-768x147.png 768w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2019\/07\/dc2de93c47bd6bce012421eba031d890_Image202019-07-2420at202.34.0920PM-1024x196.png 1024w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2019\/07\/dc2de93c47bd6bce012421eba031d890_Image202019-07-2420at202.34.0920PM-50x10.png 50w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2019\/07\/dc2de93c47bd6bce012421eba031d890_Image202019-07-2420at202.34.0920PM-60x11.png 60w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2019\/07\/dc2de93c47bd6bce012421eba031d890_Image202019-07-2420at202.34.0920PM-100x19.png 100w\" sizes=\"auto, (max-width: 2393px) 100vw, 2393px\" \/><\/p>\n<p><strong>3)<\/strong> Now that we know the ID for the admin username, the next thing to do is to open the wp_usermeta or xxx_usermeta table in the database as highlighted. (wp_ is just the prefix, your table prefix may be different)<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2362\" src=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2019\/07\/WordPress-usermeta.png\" alt=\"\" width=\"2074\" height=\"714\" srcset=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2019\/07\/WordPress-usermeta.png 2074w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2019\/07\/WordPress-usermeta-300x103.png 300w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2019\/07\/WordPress-usermeta-768x264.png 768w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2019\/07\/WordPress-usermeta-1024x353.png 1024w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2019\/07\/WordPress-usermeta-50x17.png 50w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2019\/07\/WordPress-usermeta-60x21.png 60w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2019\/07\/WordPress-usermeta-100x34.png 100w\" sizes=\"auto, (max-width: 2074px) 100vw, 2074px\" \/><\/p>\n<p><strong>4)<\/strong> In the wp_usermeta table, you can find <em>wp_capabilities<\/em> under meta_key column.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2365\" src=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2019\/07\/WordPress-Users-Capabilities-in-phpMyAdmin.png\" alt=\"\" width=\"1372\" height=\"874\" srcset=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2019\/07\/WordPress-Users-Capabilities-in-phpMyAdmin.png 1372w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2019\/07\/WordPress-Users-Capabilities-in-phpMyAdmin-300x191.png 300w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2019\/07\/WordPress-Users-Capabilities-in-phpMyAdmin-768x489.png 768w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2019\/07\/WordPress-Users-Capabilities-in-phpMyAdmin-1024x652.png 1024w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2019\/07\/WordPress-Users-Capabilities-in-phpMyAdmin-50x32.png 50w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2019\/07\/WordPress-Users-Capabilities-in-phpMyAdmin-60x38.png 60w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2019\/07\/WordPress-Users-Capabilities-in-phpMyAdmin-100x64.png 100w\" sizes=\"auto, (max-width: 1372px) 100vw, 1372px\" \/><\/p>\n<p>If the meta_value is empty, you will need to add the following value:<\/p>\n<pre>a:1:{s:13:\"administrator\";b:1;}<\/pre>\n<p>The roles are saved in the form of a serialized PHP array. Change the user role you want to assign to the current user by changing the meta_value as:<\/p>\n<pre>Administrator\na:1:{s:13:\"administrator\";b:1;}\n\nSubscriber\na:1:{s:10:\"subscriber\";b:1;}\n\nContributor\na:1:{s:11:\"contributor\";b:1;}\n\nAuthor\na:1:{s:6:\"author\";b:1;}\n\nEditor\na:1:{s:6:\"editor\";b:1;}<\/pre>\n<p>That&#8217;s it, now that you&#8217;ve added administrator role to your username, you should clear the cache and cookies for your web browser and try again to log in.<\/p>\n<h4 id=\"how-to-change-wordpress-user-roles-in-mysql-database-using-wp-cli\">How to change WordPress user roles in MySQL database using WP-CLI<\/h4>\n<p>This tutorial assumes that your web hosting provides you with access to <a href=\"https:\/\/chemicloud.com\/kb\/article\/useful-wp-cli-commands-with-examples\/\" target=\"_blank\" rel=\"noopener noreferrer\">WP-CLI<\/a> which is the WordPress command-line interface for your WordPress website.<\/p>\n    \t\t<div class=\"hts-messages hts-messages--info   hts-messages--withicon \"   >\r\n    \t\t\t    \t\t\t    \t\t\t\t<p>\r\n    \t\t\t\t\tDon\u2019t forget that ChemiCloud\u2019s infrastructure supports WP-CLI out of the box. If you\u2019d like to experience top speed and reliability and have access to great tools like WP-CLI, try our\u00a0<strong><a href=\"https:\/\/chemicloud.com\/wordpress-hosting\" target=\"_blank\" rel=\"noopener noreferrer\">WordPress hosting<\/a><\/strong>    \t\t\t\t<\/p>\r\n    \t\t\t    \t\t\t\r\n    \t\t<\/div><!-- \/.ht-shortcodes-messages -->\r\n    \t\t\n<p>1) Once you&#8217;ve accessed WP-CLI via SSH, navigate to the directory where your WordPress site is installed.<\/p>\n<p>2) You&#8217;ll have to locate first the ID number for your WordPress admin username by using the following command line:<\/p>\n<pre class=\"p1\"><span class=\"s1\">wp user list<\/span><\/pre>\n<p>This command will display all the existing usernames and the role for each:<\/p>\n<p>+&#8212;-+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;+<br \/>\n| ID | user_login | display_name | user_email | user_registered | roles |<br \/>\n+&#8212;-+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;+<br \/>\n| 1 | cch | cch | admin@chemiccloud.com | 2019-07-24 11:06:17 |<br \/>\n+&#8212;-+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;+<\/p>\n<p>As you can see, the role of our username is missing.<\/p>\n<p>3) The next step is to change the role of our username, which is using &#8220;1&#8221; as the ID, as can be seen in the first column. The command line that we&#8217;ll use is:<\/p>\n<pre>wp user set-role 1 administrator\n\nSuccess: Added cch (1) as administrator.<\/pre>\n<p>This command will attribute an administrator role to the username.<\/p>\n<p><strong>Available WordPress users roles:<\/strong><\/p>\n<ul>\n<li>administrator<\/li>\n<li>editor<\/li>\n<li>author<\/li>\n<li>contributor<\/li>\n<li>subscriber<\/li>\n<\/ul>\n<p>That&#8217;s it, now that you&#8217;ve added administrator role to your username, you should clear the cache and cookies for your web browser and try again to log in.<\/p>\n    \t\t<div class=\"hts-messages hts-messages--info    \"   >\r\n    \t\t\t    \t\t\t    \t\t\t\t<p>\r\n    \t\t\t\t\tIf you enjoyed this tutorial, then you\u2019ll love our support. All ChemiCloud\u2019s hosting plans include 24\/7 support from our amazing support team.<\/p>\n<p class=\"p1\">Check out our <a href=\"https:\/\/chemicloud.com\/managed-wordpress-hosting?utm_source=blog&amp;utm_medium=article#60b65e4e63b58\"><span class=\"s1\">Managed WordPress hosting<\/span><\/a>\u00a0plans and have your website migrated today!<\/p>\n    \t\t\t\t<\/p>\r\n    \t\t\t    \t\t\t\r\n    \t\t<\/div><!-- \/.ht-shortcodes-messages -->\r\n    \t\t\n","protected":false},"excerpt":{"rendered":"<p>While trying to access your WordPress admin panel, you may be encountering the \u201cSorry, you are not allowed to access this page\u201d error. This error will be preventing you from accessing your dashboard and making important changes to your site. What Causes the \u201cSorry, You Are Not Allowed to Access&#8230;<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"ht-kb-category":[40],"ht-kb-tag":[],"class_list":["post-2361","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-wordpress"],"_links":{"self":[{"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb\/2361","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/comments?post=2361"}],"version-history":[{"count":12,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb\/2361\/revisions"}],"predecessor-version":[{"id":8501,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb\/2361\/revisions\/8501"}],"wp:attachment":[{"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/media?parent=2361"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb-category?post=2361"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb-tag?post=2361"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}