There are 3 shortcodes that can be used:
[logout] - A standard Log Out link, where the user stays on the login screen after being logged out. [logout_to_home] - A link that logs the user out, and redirects them to your home page. [logout_to_current] - A link that logs the user out, and redirects them back to the current page/URL.
All 3 shortcodes all support 3 attributes/parameters:
[logout text="" class="" redirect=""]
The 3 supported attributes/parameters are:
– The text to use for the link anchor text.
– The HTML class(es) to use for the link. Multiple classes should be separated by a space.
– The path/URL to redirect the user to after they are logged out.
– Default: the WordPress login screen.
– Note: must be a URL or path on the same domain name as the WordPress website (cannot be an external domain/URL)
[logout text=”Log Off”] – A
Log Off link that logs the user out.
[logout redirect=”/members/”] – Log the user out, and redirect them to
[logout_to_home text=”Log Off”] – A
Log Off link that logs the user out and redirects them to your home page.
[logout class=”log-out-link”] – Use a custom CSS/HTML class name for the log out link.
Note: the shortcodes will return nothing/empty if the user isn’t logged in.
This plugin is inspired by the Logout Button plugin by Ben Poland.
If you like, you can contribute to this plugin on GitHub.
- Activate the plugin.
- Add one of the shortcodes to a post/page.
What shortcodes can be used?
Please see the plugin description for a list of shortcodes and supported parameters.
Contributors & Developers
“Log Out Shortcode” is open source software. The following people have contributed to this plugin.Contributors
Translate “Log Out Shortcode” into your language.
Interested in development?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
- Fix Typo
- Mark WP 5.5 compatible
- Mark WP 5.2 compatible
- Fix a bug that meant it was not possible to use specify multiple classes in the class=”” attribute. Thanks to @hughc for the bug report.
- WordPress 4.4 compatibility.
- Documentation updates.
- Clarify usage of the redirect=”” parameter.
- WordPress 4.1 compatibility.
- WordPress 4.0 compatibility.
- WordPress 3.9.2 compatibility.
- Add [logout] shortcode to plugin description.
- Initial release.