Instant switching between user accounts in WordPress.
Switching off logs you out of your account but retains your user ID in an authentication cookie so you can switch straight back without having to log in again manually. It's akin to switching to no user, and being able to switch back.
The Switch Off link can be found in your profile menu in the WordPress toolbar. Once you've switched off you'll see a Switch back link in the footer of your site.
Yes, and you'll also be able to switch users from the Users screen in Network Admin.
Yes, and you'll also be able to switch users from member profile screens and the member listing screen.
Yes, and you'll also be able to switch users from member profile screens.
One exception I'm aware of is Duo Security. If you're using this plugin, you should install the User Switching for Duo Security add-on plugin which will prevent the two-factor authentication prompt from appearing when you switch between users.
Yes, but you'll need to install
user-switching.php into the root of your
mu-plugins directory, not in the
user-switching subdirectory. This is a limitation of WordPress.
A user needs the
edit_users capability in order to switch user accounts. By default only Administrators have this capability, and with Multisite enabled only Super Admins have this capability.
No. This can be enabled though by installing the User Switching for Regular Admins plugin.
Yes. When a user switches to another account, the
switch_to_user hook is called with the new and old user IDs passed as parameters.
When a user switches back to their original account, the
switch_back_user hook is called with the new (original) and old user IDs passed as parameters. Note that the old user ID can be boolean false if the user is switching back after they've been switched off.
When a user switches off, the
switch_off_user hook is called with the old user ID as a parameter.
Requires: 3.7 or higher
Compatible up to: 4.7.2
Last Updated: 3 months ago
Active Installs: 70,000+
4 of 7 support threads in the last two months have been marked resolved.
Got something to say? Need help?