Title: insert profiles via SQL
Last modified: April 23, 2023

---

# insert profiles via SQL

 *  Resolved [fredyms](https://wordpress.org/support/users/fredyms/)
 * (@fredyms)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/insert-profiles-via-sql/)
 * I need to insert abot 200 new roles there is a way via SQL or php to insert a
   list of roles in bulk mode (not one by one)
 * thanks in advance
    -  This topic was modified 3 years, 1 month ago by [fredyms](https://wordpress.org/support/users/fredyms/).
    -  This topic was modified 3 years, 1 month ago by [fredyms](https://wordpress.org/support/users/fredyms/).
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Finsert-profiles-via-sql%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Caseproof LLC](https://wordpress.org/support/users/caseproof/)
 * (@caseproof)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/insert-profiles-via-sql/#post-16681814)
 * Hi [@fredyms](https://wordpress.org/support/users/fredyms/)
 * I don’t know a plugin that allows you to add 200 new roles in bulk, but you can
   install [Code Snippets](https://wordpress.org/plugins/code-snippets/) plugin 
   and run PHP code snippet similar to the one below once. This code will loop over
   roles in the array and add multiple roles with the same capabilities as Subscriber
   role:
 *     ```wp-block-code
       $roles = array(
           'basic' => 'Basic',
           'professional' => 'Professional',
           'advanced' => 'Advanced'
       );
       foreach( $roles as $role_name => $display_name ) {
           add_role( $role_name, $display_name, get_role( 'subscriber' )->capabilities );
       }
       ```
   
 * I hope that helps.
 *  Thread Starter [fredyms](https://wordpress.org/support/users/fredyms/)
 * (@fredyms)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/insert-profiles-via-sql/#post-16684264)
 * Hi, thank you, it worked perfectly, the name of the role has completed ok, but
   the profile instead of role has put a sequential number.
 * I would like the role field to be filled in with the same name as the role name.
 * but it works and solved the problem.
 * thank you very much for your support

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘insert profiles via SQL’ is closed to new replies.

 * ![](https://ps.w.org/members/assets/icon-256x256.png?rev=3508404)
 * [Members - Membership & User Role Editor Plugin](https://wordpress.org/plugins/members/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/members/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/members/)
 * [Active Topics](https://wordpress.org/support/plugin/members/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/members/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/members/reviews/)

## Tags

 * [sql](https://wordpress.org/support/topic-tag/sql/)

 * 2 replies
 * 2 participants
 * Last reply from: [fredyms](https://wordpress.org/support/users/fredyms/)
 * Last activity: [3 years, 1 month ago](https://wordpress.org/support/topic/insert-profiles-via-sql/#post-16684264)
 * Status: resolved