Shortcode Login as User [PRO only]
The [login_as_user]
shortcode allows you to add a "Login as User" button to any post, page, or widget on your WordPress site. This facilitates easy and direct login as a specific user, which is particularly useful for administrators who need to quickly view or manage the site from another user's perspective.
Usage
[login_as_user user_id="USER_ID" redirect_to="URL_PATH"]
Parameters
- user_id: Specify the ID of the user you want to impersonate. This parameter is required.
- redirect_to: Provide a URL or path to which the user should be redirected after logging in as the specified user. This parameter is optional.
Example
[login_as_user user_id="357" redirect_to="/welcome-page"]
In this example, the shortcode will render a button that allows a logged-in user to log in as the user with ID 357
. After logging in, the user will be redirected to /welcome-page
.
Important Notes
- Replace
"357"
with the actual user ID of the account you wish to log in as. - Replace
"/welcome-page"
with the actual path or URL where you want the user to be redirected after logging in. - Ensure that you use valid URLs or WordPress path standards for the
redirect_to
parameter to avoid navigation errors. - Use this feature responsibly, especially on live sites, as it allows significant control over user accounts.
This shortcode is a powerful tool for site administrators and should be used with caution to ensure security and privacy.
* This feature is available only in the premium version of the plugin.