You do not have sufficient permissions to access this page

Are you getting "You do not have sufficient permissions to access this page." errors everywhere in the WordPress admin? I had this happening on a site, apparently the problem is that somebody changed the database prefix. It's a little suprising that this would totally break the admin, but whatever...

As usual, make a DB backup before running this code, yadda yadda..

UPDATE PREFIX_usermeta SET meta_key=REPLACE(meta_key , 'OLD_PREFIX_', 'PREFIX_');
UPDATE PREFIX_options SET option_name='PREFIX_user_roles' WHERE option_name='wp_user_roles';

11 comments

  1. avatar
    wrote this comment on
    Thanks so much - I have been looking everywhere for this.

    I just moved my site from IIS to LAMP server and had this issue.
    Was due to case sensitivity of LAMP - Caps in IIS was ignored - gosh it took ages to work out!

    Thanks for this.
    1. avatar
      wrote this comment on
      Great!
  2. avatar
    wrote this comment on
    where do I put the code?
    I have read some articles about this and I found that plugins using jquery also makes this problem. How do I fix this? I'm using Wordprss 3.3.2.
    The plugin is WPLockz.
    Hoping for your positive response. Thanks
    1. avatar
      wrote this comment on
      I'm really not sure what you mean. I don't see how this could be related to jquery at all. This is really an exotic bug, the code should be entered into the mysql command line, and only if you understand 100% what you are doing.
      1. avatar
        wrote this comment on
        What if you don't understand 100% what you are doing? How might you fix the bug then?

        Didn't really go into wordpress expecting to have mysql knowledge, haha.
        1. avatar
          wrote this comment on
          This is a very bizarre bug and it's highly unlikely that this is what's causing the error. My solution can only be a solution if you get this error on ALL pages AND you or your developer messed with the database (in a bad way). Usually the problem is related to the roles/permissions system.
  3. avatar
    wrote this comment on
    Thanks you very much. I changed my hosting service and spent two days for this problem.
  4. avatar
    wrote this comment on
    hi, I can access the user admin but for the editor it says "You do not have sufficient permissions to access this page." even they just edit the page or the post. Is this the same solution for this?

    Thank you.
    1. avatar
      wrote this comment on
      No
  5. avatar
    wrote this comment on
    Search from mydb
    SELECT *
    FROM `my_db`.`wpen_usermeta`
    WHERE (
    CONVERT( `umeta_id`
    USING utf8 ) LIKE '%wpmn%'
    OR CONVERT( `user_id`
    USING utf8 ) LIKE '%wpmn%'
    OR CONVERT( `meta_key`
    USING utf8 ) LIKE '%wpmn%'
    OR CONVERT( `meta_value`
    USING utf8 ) LIKE '%wpmn%'
    )
    LIMIT 0 , 30
    1. avatar
      wrote this comment on
      No idea what this is good for.. but I didn't delete the comment because.. not even sure about that..

Start a new thread

Cancel reply
Markdown. Syntax highlighting with <code lang="php"><?php echo "Hello, world!"; ?></code> etc.