Posted on

How to change WordPress user role from Database

User role fields are under $prefix_options table with the option name $prefix_user_roles and the role is assign via user_metadata. To change the user role, update it in user_metadata table. For example, to convert all users from subscriber to author:

update wp_usermeta set meta_value='a:1:{s:6:"author";b:1;}' where meta_value='a:1:{s:10:"subscriber";b:1;}'
#vise versa
update wp_usermeta set meta_value='a:1:{s:10:"subscriber";b:1;}' where meta_value='a:1:{s:6:"author";b:1;}'
Leave a Reply

Your email address will not be published. Required fields are marked *