How to Force Logout any Users in WordPress

July 1, 2024

How to Force Logout any Users in WordPress

In this article, we’ll be discussing how you can force logout any users in WordPress and show them a popup that they have been logged out. We’ll be using the Inactive Logout plugin for this.

Why Force Logout Users in WordPress?

Force logout can be helpful in removing unwanted sessions if any passwords were compromised. You can force logout any users as an admin before a user can make unwanted changes. Basically, If a user’s account is compromised, logging them out can prevent further damage.

Secondly, Managing active sessions can help reduce server load and prevent unauthorized access upto some degree. So, you can hook up a cronjob to logout any users who have closed their browser.

Requirements

You’ll need the free version of the Inactive Logout plugin initially to track user idle sessions. To enable the forced logout feature and customize the popup message, you’ll also require the pro version of the Inactive Logout plugin.

How to force logout a User

After you’ve installed the pro version of the Inactive Logout plugin, navigate to the wp-admin dashboard and go to the Users section. Here, you will see a logout button for each user, as shown in the screenshot below. This allows you to easily force logout individual users directly from the admin panel.

Click on the logout button to force logout this user from all sessions.

Showing Popup notification that the user has Logged out

With inactive logout pro version you can show a popup to the user when admin force logs that specific user. User will see a popup on their side that they have been logged out.

When an admin force logs out a user, the user will be logged out and will receive a popup notification similar to the one shown in the image below. This popup informs the user that they have been logged out, provides a reason, and instructs them to contact the administrator if they believe this action was taken in error. The message also includes a countdown before the user is redirected.

You can also customize this message from inactive logout settings page.

Logged Out Modal

Another handy feature about this is that if there is something wrong on your site perhaps an error maybe then the popup would automatically trigger as well.

This is how you can force logout any users in your WordPress site. Inactive Logout has many other features not limited this though. You can check this out on the pricing page table.

Enhance your Security right away.

Get concurrent logins, browser close logout, and more by upgrading.

Upgrade Inactive Logout