Sql query to bulk change roles in Wordpress in the database?

↘锁芯ラ 提交于 2021-02-20 02:46:11

问题


Wordpress: I need to bulk change user roles in the database using the "user id". Something like:

"Find users with id: 2827, 772, 234, 983, 14999 and set their rol to "custumer"

I know that the roles are saved in the table "wp_usermeta" in the fields "meta_key=wp_capabilities" and "meta_value=a:1:{s:6:"editor";b:1;}".

But I don't know how to create the slq query to search and replace them to change their values.See capture attached.


回答1:


Easiest for me is to use phpmyadmin and edit one record. The response will give you the proper sql statement. Then run that for the other ids



来源:https://stackoverflow.com/questions/45925219/sql-query-to-bulk-change-roles-in-wordpress-in-the-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!