Digital Marketing

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;}'

Comments

Popular posts from this blog

MySQL Sandbox with the Sakila sample database