“You need a higher level of permission” after admin changing. Why?

I can’t edit my website, when I try to edit, I see the page with the message:

You need a higher level of permission.
Sorry, you are not allowed to customize this site.

It was started when I create a new super admin user and delete an old user with ID_1 (which was created when WordPress is installed). Now I have a super admin user but can’t edit the website.
I tried deactivating all plugins, but it does not help.

How to fix it?

1 Answer
1

Try to give yourself admin rights programmatically by placing this snippet in your functions.php.

add_action('init', function(){
    // use your user id
    $user = get_user_by( 'id', $yourUserId);

    // Give yourself the admin role
    $user->add_role( 'administrator' );
});

Leave a Comment