Title: Include User Switching Link Outside users.php
Last modified: September 3, 2019

---

# Include User Switching Link Outside users.php

 *  Resolved [Ellis Benus](https://wordpress.org/support/users/glaxton/)
 * (@glaxton)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/include-user-switching-link-outside-users-php/)
 * Is it possible to create a “Switch To” link in a location other than the users.
   php page?
 * I would like to use this capability with a custom plugin I’ve developed to put
   a button for someone to sign in as the user a custom post type is tied to.
 * I cannot call the action_personal_options() function directly and it seems I 
   cannot create a new instance of the class user_switching either.
 * Any help is appreciated.

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

 *  Plugin Author [John Blackbourn](https://wordpress.org/support/users/johnbillion/)
 * (@johnbillion)
 * WordPress Core Developer
 * [6 years, 9 months ago](https://wordpress.org/support/topic/include-user-switching-link-outside-users-php/#post-11896014)
 * Yeah you can do this with the following code:
 * `$link = user_switching::maybe_switch_url( $user )` where `$user` is an instance
   of `WP_User`.
 * It’ll return the URL for switching to the user if the current user can switch
   to the given user, or boolean false if not.
 *  Thread Starter [Ellis Benus](https://wordpress.org/support/users/glaxton/)
 * (@glaxton)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/include-user-switching-link-outside-users-php/#post-11903012)
 * Epic! Thank you so much! Could you possibly add this to the documentation of 
   the plugin b/c I searched and counldn’t find anything about it.
 * Great plugin. 5 stars. And thank you so much for your rapid response!

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

The topic ‘Include User Switching Link Outside users.php’ is closed to new replies.

 * ![](https://ps.w.org/user-switching/assets/icon.svg?rev=3193956)
 * [User Switching](https://wordpress.org/plugins/user-switching/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/user-switching/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/user-switching/)
 * [Active Topics](https://wordpress.org/support/plugin/user-switching/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/user-switching/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/user-switching/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Ellis Benus](https://wordpress.org/support/users/glaxton/)
 * Last activity: [6 years, 9 months ago](https://wordpress.org/support/topic/include-user-switching-link-outside-users-php/#post-11903012)
 * Status: resolved