Title: Admin Bar User Switching
Author: Saad Iqbal
Published: <strong>November 27, 2014</strong>
Last modified: May 24, 2022

---

Search plugins

![](https://ps.w.org/admin-bar-user-switching/assets/banner-772x250.png?rev=1419846)

This plugin **hasn’t been tested with the latest 3 major releases of WordPress**.
It may no longer be maintained or supported and may have compatibility issues when
used with more recent versions of WordPress.

![](https://ps.w.org/admin-bar-user-switching/assets/icon-128x128.png?rev=1419846)

# Admin Bar User Switching

 By [Saad Iqbal](https://profiles.wordpress.org/saadiqbal/)

[Download](https://downloads.wordpress.org/plugin/admin-bar-user-switching.1.4.zip)

 * [Details](https://wol.wordpress.org/plugins/admin-bar-user-switching/#description)
 * [Reviews](https://wol.wordpress.org/plugins/admin-bar-user-switching/#reviews)
 *  [Installation](https://wol.wordpress.org/plugins/admin-bar-user-switching/#installation)
 * [Development](https://wol.wordpress.org/plugins/admin-bar-user-switching/#developers)

 [Support](https://wordpress.org/support/plugin/admin-bar-user-switching/)

## Description

This plugin was originally developed by [Mark Wilkinson](https://markwilkinson.me/).

An admin bar “Switch to User” option is provided which on hover provides a search
box where you can query a user to switch to. The results are links to switch to 
that user. This plugin is great for when you are building sites for clients and 
it is beneficial to see the site as your logged in client see’s it.

And there is an optional mode where you can use a custom keyboard combination, say‘
su’, and it activates the form where you search for users, and then you can use 
keyboard arrows to navigate the list of results, and the return key to switch to
the selected user. The same combo can be used to focus the ‘Switch Off’ link, following
a return to simulate a click.

To activate this feature and set the custom keyboard combination, aka magic word,
you need to use the `abus_ajax_args` and add a ‘magicWord’ variable.

Note that keyboard navigation is not dependant on the custom keyboard combination,
and can be used out of the box.

## Screenshots

 * [[
 * A Switch to user item is added to the WordPress admin bar to allow you to search
   for a user to switch to.

## Installation

To install the plugin:

 1. Upload to the `/wp-content/plugins/` directory
 2. Activate the plugin through the ‘Plugins’ menu in WordPress

## FAQ

### How do I switch to a user?

As with the User Switching plugin you can still use the “Switch To” link on the 
users overview page – nothing changes there. However the point of this plugin is
that it gives you a Switch to User link in the WordPress admin bar. This reveals
a search box where you can search for a users username. The results of this search
are clickable to “Switch To” that user.

And there is an optional mode where you can use a custom keyboard combination, say‘
su’, and it activates the form where you search for users, and then you can use 
keyboard arrows to navigate the list of results, and the return key to switch to
the selected user. The same combo can be used to focus the ‘Switch Off’ link, following
a return to simulate a click.

### What can be entered into the username search box?

You can enter a user ID, part of / exact username, URL, email, or display name, 
WordPress automatically chooses the best fields to match to based on your input.
[See here for more information on wildcard searches](https://codex.wordpress.org/Class_Reference/WP_User_Query#Search_Parameters).
Clicking submit with nothing in the search box will search all users except the 
current logged in user.

### Has the plugin any filters or actions for developers?

It does indeed, although not too many! The following filters can be used.

 * abus_switch_to_text – allows developers to change the text that is displayed 
   in the admin menu which, when on hover shows the search box
 * abus_form_output – this filter can be used to change the markup of the form which
   is used in the plugin for user searching
 * abus_switch_back_text – this filter is used to change the text shown to switch
   back to the original logged in user
 * abus_switch_to_url – this filter is used to alter the redirect url for different
   users as the filter is passed to switch to user user object
 * abus_ajax_args – this is used to activate the magic word combo as described in
   plugin description, ‘magicWord’ variable can be added to the array to activate
   the feature

## Reviews

![](https://secure.gravatar.com/avatar/6cfc8c01f1ea3a75ec6f7dba8f2a014ef4cca4fd63a50fb3c8772e492e472ecc?
s=60&d=retro&r=g)

### 󠀁[Switching Back Easy, Switching To Harder than need be](https://wordpress.org/support/topic/switching-back-easy-switching-to-harder-than-need-be/)󠁿

 [Dennis Bareis](https://profiles.wordpress.org/dbareis/) June 2, 2024

It is easy to switch back from a switched to account, not so easy to switch away
as a user list is not displayed, you have to search first. Ideally I’d have an option
to choose the accounts and have a button for each.

![](https://secure.gravatar.com/avatar/1357eeb7876812255641bdbbc72148618c45bce3a73af9e2d405e35f6eda45f5?
s=60&d=retro&r=g)

### 󠀁[Good job!](https://wordpress.org/support/topic/good-job-1608/)󠁿

 [neon67](https://profiles.wordpress.org/neon67/) June 19, 2022

10nx very so much

![](https://secure.gravatar.com/avatar/e39bab2a090afcc4ffc6888823566c5357edc80437d6c729cf7d86e79eb1bb39?
s=60&d=retro&r=g)

### 󠀁[Good Support](https://wordpress.org/support/topic/good-support-496/)󠁿

 [SimpleRick](https://profiles.wordpress.org/keramikoch/) December 17, 2021

Fast fixing of errors 🙂 Plug-In works like it should

![](https://secure.gravatar.com/avatar/8a03ff342c90e8dda600695d110f37d2adeed82ea12089075fa614a448e619ba?
s=60&d=retro&r=g)

### 󠀁[Идеальный плагин](https://wordpress.org/support/topic/%d0%b8%d0%b4%d0%b5%d0%b0%d0%bb%d1%8c%d0%bd%d1%8b%d0%b9-%d0%bf%d0%bb%d0%b0%d0%b3%d0%b8%d0%bd/)󠁿

 [Сергей](https://profiles.wordpress.org/erenbur/) October 2, 2020

Чувак! Ты сделал идеально работающую вещь! :)))

![](https://secure.gravatar.com/avatar/22dcf41213b58505959c76ae20650595fbd28c9653c683591c3c6f14d60f1aa5?
s=60&d=retro&r=g)

### 󠀁[Could be better](https://wordpress.org/support/topic/could-be-better-31/)󠁿

 [lucasbustamante](https://profiles.wordpress.org/lucasbustamante/) August 7, 2018
2 replies

Suggestions: Option to show dropdown instead of text input (from personal experience,
most of the time site only have 2~3 users) Dropdown is loosing focus when trying
to click on it, it’s kinda annoying Uninstalled it right away, but could be a good
thing with some tweaks.

![](https://secure.gravatar.com/avatar/ef200ee7233d2b56bd663540b5a4770b9934b754fd1981a53f98400d62fcebef?
s=60&d=retro&r=g)

### 󠀁[Perfect!](https://wordpress.org/support/topic/perfect-3919/)󠁿

 [smart.u](https://profiles.wordpress.org/smartu-1/) April 3, 2017

Perfect! Thank you!

 [ Read all 12 reviews ](https://wordpress.org/support/plugin/admin-bar-user-switching/reviews/)

## Contributors & Developers

“Admin Bar User Switching” is open source software. The following people have contributed
to this plugin.

Contributors

 *   [ Saad Iqbal ](https://profiles.wordpress.org/saadiqbal/)
 *   [ WPExperts.io ](https://profiles.wordpress.org/wpexpertsio/)

[Translate “Admin Bar User Switching” into your language.](https://translate.wordpress.org/projects/wp-plugins/admin-bar-user-switching)

### Interested in development?

[Browse the code](https://plugins.trac.wordpress.org/browser/admin-bar-user-switching/),
check out the [SVN repository](https://plugins.svn.wordpress.org/admin-bar-user-switching/),
or subscribe to the [development log](https://plugins.trac.wordpress.org/log/admin-bar-user-switching/)
by [RSS](https://plugins.trac.wordpress.org/log/admin-bar-user-switching/?limit=100&mode=stop_on_copy&format=rss).

## Changelog

#### 1.4 – 2021-17-12

 * Fixed – Fixed Undefined Variable $port.

#### 1.3 – 2021-22-10

 * Fixed – Deprecated error.

#### 1.2 – 2020-02-11

 * Update – WordPress 5.3 compatibility
 * Tweak – Update and modernize the codebase

#### 1.1.1

 * Only enqueue js if the user is logged in
 * Do not seperately enqueue jQuery as it is already stated as a dependency

#### 1.1

 * Add keyboard navigation
 * Add magic-word feature, keyboard-only usage of the plugin
 * Focus search input on clicking the admin-bar button – thanks to [@shadyvb](https://github.com/shadyvb)
   for work on these features
 * Allow search on any user fields rather than just the login or username
 * Make the search query parameters extensible with a filter so developers can easily
   edit them
 * Escape calls to $_POST in the ajax search function

#### 1.0.6

 * Make the capability (edit_users by default) needed to be able to switch to users
   be filterable.

#### 1.0.5

 * Escape instances of add_query_arg in accordance with https://make.wordpress.org/
   plugins/2015/04/20/fixing-add_query_arg-and-remove_query_arg-usage/

#### 1.0.4

 * Correct an issues which could result in a PHP error when the plugin is active
   and the User Switching plugin is not active.
 * Add filter for the switch to redirect url named `abus_switch_to_url` – this allows
   devs to alter the redirect url for different users as the filter is passed to
   switch to user user object.

#### 1.0.3

 * Output styles on both front and backend to make the form look correct when results
   are returned.
 * Create a filter for developers to amend the styles as needed to match their theme
 * Use correct hook for enqueuing javascript file
 * Make sure the current logged in user does not appear in the search results

#### 1.0.2

 * Thanks for @johnbillion for pointing out the incorrect capabilities check for
   switch_to_user. This now checks against edit_user so users who can edit users
   will be the Switch to link.

#### 1.0.1

 * Use switch_to_user user capability instead of is_super_admin when checking whether
   to display Switch to link in admin bar.

#### 1.0

 * Make the Switch to User link reveals a user search box
 * Uses AJAX to populate the user switch to list which therefore makes the plugin
   more compatible for sites with lots of users.

#### 0.1

 * Initial release.

## Meta

 *  Version **1.4**
 *  Last updated **4 years ago**
 *  Active installations **2,000+**
 *  WordPress version ** 3.1 or higher **
 *  Tested up to **6.0.11**
 *  PHP version ** 5.6 or higher **
 *  Language
 * [English (US)](https://wordpress.org/plugins/admin-bar-user-switching/)
 * Tags
 * [user switching](https://wol.wordpress.org/plugins/tags/user-switching/)[users](https://wol.wordpress.org/plugins/tags/users/)
 *  [Advanced View](https://wol.wordpress.org/plugins/admin-bar-user-switching/advanced/)

## Ratings

 4.8 out of 5 stars.

 *  [  10 5-star reviews     ](https://wordpress.org/support/plugin/admin-bar-user-switching/reviews/?filter=5)
 *  [  2 4-star reviews     ](https://wordpress.org/support/plugin/admin-bar-user-switching/reviews/?filter=4)
 *  [  0 3-star reviews     ](https://wordpress.org/support/plugin/admin-bar-user-switching/reviews/?filter=3)
 *  [  0 2-star reviews     ](https://wordpress.org/support/plugin/admin-bar-user-switching/reviews/?filter=2)
 *  [  0 1-star reviews     ](https://wordpress.org/support/plugin/admin-bar-user-switching/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/admin-bar-user-switching/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/admin-bar-user-switching/reviews/)

## Contributors

 *   [ Saad Iqbal ](https://profiles.wordpress.org/saadiqbal/)
 *   [ WPExperts.io ](https://profiles.wordpress.org/wpexpertsio/)

## Support

Got something to say? Need help?

 [View support forum](https://wordpress.org/support/plugin/admin-bar-user-switching/)