WPLounge

How to impersonate another user in WordPress

How to impersonate another user in WordPress

If you’re the admin of a WordPress website, it can be very useful to impersonate another user. This way you can check if all the access rights for that user are set up correctly.

When you add new functionality to your website, you may want to test this functionality in another user’s account. Another example is if one of your users claims that certain functionality is not working. By impersonating that user, it’s easy to rule out any issues with their account or user rights.

WPLOUNGE RECOMMENDS..
Divi theme & Divi Builder
Elegant Themes is selling more than
85 premium themes (including Divi!) for only $89!
Check Elegant Themes »
The links above are affiliate links.

Of course, you can manually log out and log in with someone else’s account. However, this means that you need to either know their password or reset it. This takes a lot of time and is not very efficient. In this article we’ll show you how to easily switch user accounts in WordPress.

How to impersonate another user in WordPress

Even though it can be very useful for a website administrator, impersonating other users is not default functionality in WordPress. By default, WordPress lets you create new users and assign a role for that user. When going to Settings > General in WordPress, you can also allow visitors to register for an account and choose a default user role for those users.

To be able to quickly switch users, I use a plugin called User Switching. This plugin also works with WordPress Multisite, BuddyPress and bbPress. After installing and activating the plugin, a new option is added to the Users > All Users screen in WordPress:

Impersonate another user WordPress

When hovering over a user, a “Switch To” link will be visible. When clicking that link, you will be logged in to that user’s account. Of course, this feature is only available for users that have the “Administrator” role in your WordPress install.

After switching between accounts, you will see a new notification in the top of your admin screen, allowing you to switch back to your own account instantly:

Switch back

Just click the “Switch back” link to go back to your own user account.

“Switch Off”

Switch OffThe User Switching plugin also contains a “Switch Off” feature. By clicking the “Switch Off” link (in the top right of the WordPress toolbar), you’ll be logged out of WordPress, but you retain the ability to switch back to your account without having to manually log in to WordPress. It will remember you by storing an authentication cookie in your browser.

After you click “Switch Off” in the WordPress menu bar, you’ll be sent back to the front end of your website. However, in the very bottom of your screen a new link can be found:

Switch back

Click this link and you will be logged back in to your WordPress website without having to re-enter your login credentials. This can be very useful for testing (e.g. you want to see what your website looks like for users that are not logged in). However, make sure to only use this feature on your own private computer, as it will allow anyone to login to your (Admin) account without using any form of authentication.

Rate this article

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 5.00 out of 5)
Loading...

Wouter Postma

Co-owner of WPLounge.nl, the biggest Dutch blog about WordPress.

Comment