wp_logout()
Log the current user out.
Description Description
Source Source
File: wp-includes/pluggable.php
function wp_logout() { wp_destroy_current_session(); wp_clear_auth_cookie(); wp_set_current_user( 0 ); /** * Fires after a user is logged-out. * * @since 1.5.0 */ do_action( 'wp_logout' ); }
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
2.5.0 | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
Example
Feedback
Warning: This function logs the user out as soon as it is called. Don’t add it to button values or widgets using a plugin to insert PHP. If you do so, you might lose access to your admin because you will be logged out every time you visit a page. If you want to create a Logout button, or a link the user can click to log out, use wp_logout_url() instead. — By carike —