Changing a wordpress user to an admin

前端 未结 3 1867
刺人心
刺人心 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:37

    Here is how to change assign a User to the Admin Role in WordPress using MySQL statements:

    -- Look at the field called "id" in the result set
    ---
    select * from wp_users
    where user_login = 'WORDPRESS_USERNAME_GOES_HERE';
    
    -- Substitute the above "id" value in the "user_id" field below.
    -- This is an integer value so do not use quotes around it
    -- For example if the above "id" is the value 10 then the resulting line would be: where user_id = 10
    -- 
    update wp_usermeta
    set meta_value = 'a:1:{s:13:"administrator";s:1:"1";}'
    where user_id = USER_ID_GOES_HERE
    and meta_key = 'wp_capabilities';
    
    -- Lastly execute this statement remembering to substitute the same "id" value
    update wp_usermeta
    set meta_value = '10'
    where user_id = USER_ID_GOES_HERE
    and meta_key = 'wp_user_level';
    

提交回复
热议问题