I changed my DNS nameservers to CloudFlare from my hosting DNS nameservers and when I logged in to my WordPress dashboard it shows an error message "Sorry, you are not allowed to access this page.". What should I do now and how to fix it?

1 Answer 1


Try to deactivate all your activated plugins :) mainly your security plugins installed like wordfence.

Check your .htaccess file, and your .htaccess file should look like - '

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
  • Enable WordPress Debug option by adding this code to your wp-config.php file. define( 'WP_DEBUG', true );

  • Using a version of PHP that’s incompatible with the release of WordPress you have installed often creates this error. Upgrading your version of PHP can usually resolve this issue.

  • Deactivate all your activated plugins using FTP or phpMyAdmin.

  • You need to check the prefix that’s written in your wp-config.php and check it against the prefix that’s listed in your database. Be sure that the prefixes in both the wp-config.php file and the database contain all lowercase letters for any that are included. Be sure to double check the values for the wp_capabilities and wp_user_level columns in the wp_users table for the correct prefix.

It’s also important to check the wp_usermeta table for incorrect references to the prefix you chose in the meta_key column. Then, look over the wp_options table for incorrect references in the values for the option_name and wp_user_roles columns.

Also, try to remove https, maybe your where using Cloudflare Free SSL and now you don't have SSL installed in your hosting,

You can add this code to your wp-config.php



Also, you can use the search and replace plugin to remove all https to HTTP from the database.

  • I had removed the column prefix but had missed references to the prefix in usermeta and options. Thanks! Commented Dec 12, 2023 at 16:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.