Plugins Plugin hub Backup SEO Caching Security Forms WooCommerce Images Best backup plugins
Hosting Hosting directory Shared hosting Managed WordPress Cloud hosting VPS hosting By reader location Hosting finder
Themes & builders Compare Rank Math vs Yoast
Tools All tools Hosting finder Plugin stack builder Cost calculator Salt generator Theme detector Who is hosting this? Speed test Headline analyzer robots.txt generator Redirect generator Uptime calculator Blog name generator
Blog Best backup plugins Deals
Guides All guides Speed up WordPress Choose hosting Back up WordPress
How we test

Setup & site building · Guide

How to Logout of WordPress (Step by Step)

How to Logout of WordPress (Step by Step)

Short answer

Hover over your name next to Howdy in the top-right corner of the WordPress toolbar and click Log Out. If the toolbar is hidden, open the login page with the logout action added and confirm. To end sessions on other devices, use Log Out Everywhere Else in your profile.

Key takeaways

  • The Log Out link sits under the Howdy menu in the toolbar.
  • Closing the browser tab does not end your session.
  • Log Out Everywhere Else ends sessions on other devices.
  • Admins can end another user's sessions from the user edit screen.
  • Changing security keys logs every user out.
  • Caching can make it look as if logout failed.

How do you log out of WordPress?

Hover over your name in the top-right corner of the admin toolbar, where it says Howdy, and click Log Out in the dropdown.

That is the standard way on every self-hosted WordPress site. It works from the dashboard and from the front of the site, as long as the toolbar is showing.

WordPress then ends your session, clears your login cookies and sends you back to the login screen with a message saying you are logged out.

Cookies are small pieces of data your browser stores for a website. MDN's guide to HTTP cookies explains how they work. WordPress uses them to remember who you are between page loads, which is why logging out mainly means removing them.

The rest of this guide covers the other cases: when the toolbar is hidden, when you want to log out of every device, when logout seems not to work, and how developers add a logout link.

How do you log out from the WordPress dashboard?

In the dashboard, the toolbar is always at the top; hover over your username or avatar at the far right and choose Log Out.

On a small screen, the toolbar collapses. Tap your avatar at the top right to open the account menu, then tap Log Out.

If you are on a shared or public computer, always log out this way rather than just closing the browser tab. Closing the tab does not end your session.

It is also worth closing the whole browser window afterwards on a public machine. That clears any other site sessions you may have opened at the same time.

You can confirm it worked by visiting your admin URL again. You should see the login form instead of the dashboard. Our guide to the WordPress admin URL explains where that is on most sites.

How do you log out when the toolbar is hidden?

Visit your site's login address with ?action=logout added, such as /wp-login.php?action=logout, then click the confirmation link WordPress shows.

Some sites hide the toolbar on the front end. Each user can turn it on or off with the Show Toolbar when viewing site option in Users > Profile.

When you open the logout address directly, WordPress asks Do you really want to log out? and shows a link. This check stops other websites from logging you out without your consent.

Click the link and you are logged out. Bookmarking this address is handy if you work on several sites with hidden toolbars.

How do you log out of all devices at once?

Go to Users > Profile, scroll to the Sessions section, and click Log Out Everywhere Else to end every session except the one you are using.

This is useful if you logged in on a shared computer, lost a phone, or think someone else has your password.

The button only appears when you have more than one active session. If you see no button, you are only logged in on your current device.

After a suspected break-in, change your password as well. Our guide on how to change a WordPress password covers the steps.

Adding two-factor authentication makes a stolen password much less useful.

How can an admin log out another user?

Administrators can open Users, edit the user, and click Log Out Everywhere in the Sessions section to end all of that user's sessions.

This is helpful when someone leaves a team, a contractor's work ends, or an account looks compromised.

Logging a user out does not stop them logging back in. To remove access fully, change their password, lower their role, or delete the account and assign their content to someone else.

Ending sessions is still a useful first step. It cuts off anyone who is using a stolen cookie right now, while you decide what else to change on the account.

Our explainer on WordPress user roles shows what each role can do, so you can give people only the access they need.

How do you log every user out of the site?

Change the security keys and salts in wp-config.php, which invalidates every login cookie and forces all users, including you, to log in again.

WordPress uses these keys to sign login cookies. Replacing them makes every existing cookie invalid at once.

Generate a new set with the official WordPress salt generator, then replace the matching lines in wp-config.php. Some security plugins can do this for you with one button.

Take a backup of wp-config.php before editing. A typo in that file can take the whole site down.

How long does WordPress keep you logged in?

By default, WordPress keeps you logged in for about two days, or about 14 days if you tick Remember Me on the login form.

When that time runs out, WordPress asks you to log in again. The length is set by the login cookie expiry, which developers can change with the auth_cookie_expiration filter.

If you are logged out too often, check whether a security plugin shortens sessions, or whether your browser deletes cookies when it closes.

On shared computers, leave Remember Me unticked. The shorter session means a forgotten login expires sooner, even if you forget to log out.

If you are stuck in a loop of being sent back to the login page, see our guide on fixing the login page refreshing and redirecting.

Why does logging out not seem to work?

Usually a page cache, browser cache or a mismatch between site URLs makes it look as if you are still logged in after logging out.

Caching plugins and server caches should not cache pages for logged-in users. If they do, you may see an old page showing the toolbar after you log out. Clear the cache and reload.

Your browser can also show a cached copy. Press reload, or open the site in a private window to check.

If your WordPress Address and Site Address use different forms, such as with and without www, cookies may be set for one and not the other. Make them match in Settings > General.

Developers can print a logout link with the wp_logout_url() function, which includes the security token and an optional redirect address.

The wp_logout_url() reference shows the details. A simple example in a theme template looks like this:

<?php if ( is_user_logged_in() ) : ?>
  <a href="<?php echo esc_url( wp_logout_url( home_url() ) ); ?>">Log out</a>
<?php endif; ?>

That link logs the user out without the confirmation step and sends them to the home page.

You can change home_url() to any page on your site, such as a goodbye page or the login screen. Keep the redirect on your own domain, because WordPress only allows safe redirects by default.

If you do not write code, membership, LMS and shop plugins often include a logout link in their account pages or menus. Check their settings first.

How do you log out of the WordPress mobile app or WordPress.com?

In the WordPress mobile app, open your profile or account settings and choose the log out option; on WordPress.com, use the account menu on the site.

WordPress.com is a hosted service with its own account system. Logging out there ends your WordPress.com session, which is separate from any self-hosted site.

The mobile app can connect to both kinds of sites. Logging out of the app removes saved sites and credentials from that device.

For the difference between the two products, see whether WordPress.com or WordPress.org is better.

Which logout method should you use?

Use the toolbar for everyday logouts and the Sessions tools when you need to end logins on other devices.

SituationMethodWhere
Normal logoutHowdy menu, Log OutAdmin toolbar, top right
Toolbar hiddenLogout address and confirmLogin page with action=logout
Other devices still logged inLog Out Everywhere ElseUsers, Profile, Sessions
Remove another user's sessionsLog Out EverywhereUsers, edit user
Force all users outReplace security keyswp-config.php
Custom logout linkwp_logout_url()Theme or plugin code

More background on WordPress login is in the official Users screen documentation.

Frequently asked questions

Where is the logout button in WordPress?

It is in the account menu at the top right of the admin toolbar. Hover over or tap your name and avatar next to the Howdy greeting, then choose Log Out. On phones, tap the avatar to open the menu.

Does closing the browser log me out of WordPress?

Not always. WordPress uses login cookies that can last two days, or about two weeks with Remember Me ticked. Unless your browser deletes cookies on close, you stay logged in. Use the Log Out link instead.

How do I log out of WordPress on all devices?

Open your profile under Users, scroll to Sessions, and click Log Out Everywhere Else. Every session except your current one ends. If you suspect a stolen password, change it as well and consider adding two-factor authentication.

Why does WordPress ask if I really want to log out?

That message appears when the logout address is opened without its security token, for example from a bookmark. It protects you from other sites logging you out without consent. Click the confirmation link to finish logging out.

Why am I still logged in after clicking Log Out?

You are probably seeing a cached page. Clear your caching plugin and browser cache, then reload or use a private window. Also check that the WordPress and site addresses match exactly in the general settings.

Sources

  1. wp_logout_url() WordPress Developer Resources
  2. auth_cookie_expiration hook WordPress Developer Resources
  3. Users Your Profile Screen WordPress.org Documentation
  4. Secret key generator WordPress.org API

Is your product missing, or something out of date?

Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.

About the editors

Written and checked byWPLegible Editorial Team Independent WordPress reviews and guides

Researched from the primary sources listed above and checked against our editorial rules before publishing.