Title: Bulk Edit via Sql?
Last modified: June 3, 2020

---

# Bulk Edit via Sql?

 *  [sellyk](https://wordpress.org/support/users/sellyk/)
 * (@sellyk)
 * [6 years ago](https://wordpress.org/support/topic/bulk-edit-via-sql/)
 * Hi,
 * So we have a large amount of users on the site that we would like to change their
   user role to a role we created with the help of the plugin.
 * I know that it can be done via admin, however due to the large number of users&
   our firewall, its not possible to change all roles simultaneously & they are 
   too many to do in chunks (would take ages). So we are looking for a more efficient
   way to do so.
 * So I was wondering, is it possible for you to help me with sql query to be able
   to do so from phpmyadmin?

Viewing 1 replies (of 1 total)

 *  Plugin Author [Vladimir Garagulya](https://wordpress.org/support/users/shinephp/)
 * (@shinephp)
 * [6 years ago](https://wordpress.org/support/topic/bulk-edit-via-sql/#post-12932905)
 * Hi,
 * WordPress stores role granted to a user at the wp_usermeta DB table. You may 
   select all subscribers this way:
 *     ```
       SELECT * FROM wp_usermeta WHERE meta_key='wp_capabilities' AND meta_value='a:1:{s:10:"subscriber";b:1;}';
       ```
   
 * ‘wp_’ is a DB prefix defined at the wp-config.php.
    ‘a:1:{s:10:”subscriber”;b:
   1;}’ is a serialized PHP array with 1 element key=’subscriber’ and value=boolean
   true. Pay attention on the length of string ‘subscriber’ – s: 10. So if you need
   to replace roles for all subscribers to contributor you can use this command:
 *     ```
       UPDATE wp_usermeta SET meta_value='a:1:{s:11:"contributor";b:1;}' WHERE meta_key='wp_capabilities' AND meta_value='a:1:{s:10:"subscriber";b:1;}';
       ```
   
 * Make a fresh backup copy of your database before to make any direct update. Just
   in case something will go a wrong way.

Viewing 1 replies (of 1 total)

The topic ‘Bulk Edit via Sql?’ is closed to new replies.

 * ![](https://ps.w.org/user-role-editor/assets/icon-256x256.jpg?rev=1020390)
 * [User Role Editor](https://wordpress.org/plugins/user-role-editor/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/user-role-editor/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/user-role-editor/)
 * [Active Topics](https://wordpress.org/support/plugin/user-role-editor/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/user-role-editor/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/user-role-editor/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Vladimir Garagulya](https://wordpress.org/support/users/shinephp/)
 * Last activity: [6 years ago](https://wordpress.org/support/topic/bulk-edit-via-sql/#post-12932905)
 * Status: not resolved