Change WordPress user roles and capabilities Forums How to or FAQ How to restore user between environments Reply To: How to restore user between environments



Permissions assigned directly to users are not exported/imported by User Role Editor.
If it’s a single user it’s much simpler just grant capabilities shown at a production site page to at this user permissions page opened at the stage server.

If you wish to make it semi-automatically, you will need some SQL tool. Look at this command:

SELECT * FROM wp_usermeta where user_id=NNN and meta_key='wp_capability';

It shows user permissions stored by WordPress for this user at the database.
NNN – is your user ID.
‘wp_’ is database prefix here. So you have to change it at ‘wp_usermeta’ table name and at ‘wp_capability’ value if you have another DB prefix defined at config.php.

Then you can to copy/paste meta_value field value from the result to the previous command to a new command at the stage database connection:

update wp_usermeta set meta_value='copy/pasted value here' where user_id=NNN;