Changing a wordpress user to an admin

前端 未结 3 1865
刺人心
刺人心 2021-02-09 20:09

I am trying to set up a local copy of a production Wordpress blog. On production, I am a user but not an admin, so I am trying to change myself to an admin locally. I was follow

3条回答
  •  逝去的感伤
    2021-02-09 20:31

    To set the capabilities and user_level your meta_key value needs to match your database prefix. By default this is wp_ (resulting in wp_capabilities and wp_user_level) however it would be different in your case as you don't have a prefix. The proper capabilities value is a:1:{s:13:"administrator";s:1:"1";}.

    -- delete any existing values for this user
    DELETE FROM usermeta WHERE user_id=376 AND (meta_key LIKE '%capabilities' OR meta_key LIKE '%user_level')
    -- insert the capabilities and user_level for user_id 376
    INSERT INTO usermeta(user_id,meta_key,meta_value) VALUES(376, 'capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');
    INSERT INTO usermeta(user_id,meta_key,meta_value) VALUES(376, 'user_level', 10);
    

提交回复
热议问题