WordPress: You do not have sufficient permissions to access this page

Try a search on Google for this post’s title and you’ll find dozens and dozens of pages referring to this error. Some of them help you fixing it, some of them just link to other pages but none of them makes it really easy for you to resolve this issue fast.

Every time I move a WordPress site to another (sub-)domain, e.g. from blog.example.com to www.example.com, using blog_ and www_ as the database table prefix respectively I come across this neat error – it’s this prefix that’s causing trouble.

Basically, this prefix gets hard coded into the database during WordPress’s initial setup. Sure, there might be reasons to do this but even as a developer I must admit that this is a really annoying limitation from a pure user’s perspective.

Solution

The solution is pretty straight forward: just replace occurrences using the old table prefix in your database with the new one. You’ll find them here:

  1. prefix_usermeta
    • prefix_user_level
    • prefix_capabilities
    • prefix_autosave_draft_ids
  2. prefix_options
    • prefix_user_roles

You’ll have to make sure that prefix is the same.

Fixing it fast

You’ll want to get this done fast? Just enter your old and new prefix into the boxes below, copy the SQL snippet and apply it to your database. Done.

Old prefix:

New prefix:

7 thoughts on “WordPress: You do not have sufficient permissions to access this page”

  1. Very nice! You saved me time researching the issue by combing my database and then saved me even more time with your clever little Javascript. Cheers!

  2. Pingback: How to Move a WordPress Site | WordPress Development | CraniumStorm

  3. Its very nice blog.
    I have google things but did not find any such a perfect solution of this problem.

    but this is perfect one. great job Schenk!!
    Thanks.

  4. Solved my issue in less than 30 seconds and I don’t know SQL from a hole in the ground. Thanks!

  5. Thanks for this, but what file do I apply that code snippet to exactly? I accessed my sql info in my cpanel and I have accessed my wordpress files via ftp, yet I am clueless as to where I should be adding this code. Thanks.

  6. Hi Derek,
    this code is an SQL statement and you should execute it in your MySQL database used by WordPress via phpMyAdmin or similar. It isn’t meant to be added to a certain PHP file within WordPress but simply executed on the database.

Comments are closed.