Title: Duplicate user
Last modified: May 13, 2019

---

# Duplicate user

 *  Resolved [fid](https://wordpress.org/support/users/fid/)
 * (@fid)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/duplicate-user-2/)
 * I have a user created (lets call it template) and with that user I have enabled/
   disabled certain things in the dashboard, such as hiding some widgets, columns,
   etc.
 * Every time I create a new user, I want it to have the same settings as that template
   user.
 * How can I do this?
 * I am familiar with php, mysql.

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

 *  [Robert Anderson](https://wordpress.org/support/users/noisysocks/)
 * (@noisysocks)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/duplicate-user-2/#post-11523902)
 * Hi [@fid](https://wordpress.org/support/users/fid/)! When a user disables a box
   on their dashboard, that setting is stored in the `metaboxhidden_dashboard` user
   meta field. The user meta for a new user can be customised using the `insert_user_meta`
   filter. In this filter, you could copy over the `metaboxhidden_dashboard` field
   from the template user.
 * Example:
 *     ```
       function customize_user_meta( $meta, $user, $update ) {
       	if ( ! $update ) { // Run only when a user is created
       		$template_user = get_user_by( 'slug', 'template' );
       		$meta['metaboxhidden_dashboard'] = get_user_meta( $template_user->ID, 'metaboxhidden_dashboard', true );
       	}
       }
       add_filter( 'insert_user_meta', 'customize_user_meta', 10, 3 );
       ```
   
 * [https://developer.wordpress.org/reference/hooks/insert_user_meta/](https://developer.wordpress.org/reference/hooks/insert_user_meta/)
 *  Thread Starter [fid](https://wordpress.org/support/users/fid/)
 * (@fid)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/duplicate-user-2/#post-11523929)
 * Thanks! Does this also work for hidden columns, dismissing notices, etc?
 *  [Robert Anderson](https://wordpress.org/support/users/noisysocks/)
 * (@noisysocks)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/duplicate-user-2/#post-11523967)
 * Yes, though you might have to copy over more fields than in my example above.
   To figure out which user meta keys contain the settings that you want to copy,
   I suggest setting up WP CLI and running `wp user meta list template` to list 
   all of the user meta for the ‘template’ user.
 * [https://wp-cli.org](https://wp-cli.org)
 *  Thread Starter [fid](https://wordpress.org/support/users/fid/)
 * (@fid)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/duplicate-user-2/#post-11523987)
 * Thank you!

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

The topic ‘Duplicate user’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [fid](https://wordpress.org/support/users/fid/)
 * Last activity: [7 years, 1 month ago](https://wordpress.org/support/topic/duplicate-user-2/#post-11523987)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
