WordPress do not have a true concept of “logged in”. Although the labels all around use the term, in the code the closest you get is something that might be called “authenticated users”. The difference is that the authenticated user might be one that has his browser closed and therefor he is not “logged in”.
To do what you want you will first need to define what does it mean for you to be “logged in” and implement some logic to detect it. For example you might use ajax to update that a user is still connected and remove the user from the “logged in” list if it didn’t update for lets say 5 minutes.
It is not trivial but not very complex to implement.
Related Posts:
- Display sortable User meta column in admin panel user’s page
- Users disappeared from wp-admin
- define two login page url
- Login issue with subdomain installs
- Cannot login in WordPress even after changing hash password in phpmyadmin
- How to check if a user is in a specific role?
- How to restrict dashboard access to Admins only?
- Admin Page Redirect
- How to redirect/rewrite all /wp-login requests
- Custom login redirects to wp-admin on wrong password
- How to allow users login to WP from external domain and make REST requests
- How to display the user that published a pending post?
- Custom user role that can only edit specific (non-custom-type) page and all child pages [duplicate]
- Add a button to users.php
- create users to site with specific language
- Users are redirected to homepage instead of wp-admin
- How to move wp-admin login page to another location? [closed]
- How to display multiple custom columns in the wp-admin users.php?
- Adding body class to login page?
- Edit a WordPress site without the username and password?
- Removing user fields [duplicate]
- Change WP-Login or WP-Admin
- Users Unable to Access Dashboard/Posts/Pages
- I cannot log into my wordpress site with my wp-login.php [closed]
- Stop loading “collaborators” users on add new post or page?
- Distinguish profile user and admin user IDs / get ID of user being edited
- Can’t access WordPress as an admin – but I can log in as a user!
- Uncheck the box “Send User Notification” by default on new-user.php
- Can’t login to Dashboard when changing site URL to HTTPS
- WordPress and bbPress Login conflicts?
- Subscribers become Authors after Upgrade? / Mass Update of Users?
- I want to disable login of admin (/wp-admin) with email and make it accessible only with username
- Website looks fine, but login to wp-admin yields a blank screen
- Filter dropdown in users.php “delete user” bulk edit screen
- cannot find the login page for local WordPress site
- Modify WP-Admin login fields
- display dynamic WP Site logo on wp-admin using CSS
- How to Change The WordPress Login URL Without Plugin
- wp-admin – 404 after custom login form
- How to fix ‘WordPress redirection loop problem in wp-login.php page’?
- Logging into sandbox subdomain WP
- 404 redirect wp-login and wp-admin after changing login url [closed]
- Logout USER form backoffice after 30 minutes of inactivity [closed]
- Having troubles connecting to WordPress login page using Mamp
- Sorry, you are not allowed to access this page
- WP Admin/ WP Login Redirect to themselves
- WP admin user search doesn’t return all users
- Hide username discovery
- Cookie Domain is preventing Admin login
- Cannot access WordPress login pages
- How to get Role Subscribe Users on Admin Menu only in Pages in WordPress
- Cant login to wp-admin
- I accidentally deleted an admin user and all their content is now gone from the site. [closed]
- /wp-admin/ doesn’t work but /admin/ does
- Restrict submitters from wp-admin [duplicate]
- Why am I locked out of the system?
- Why can I log into wp-login.php and not wp-admin.php?
- Disable Admin CP authentication (or auto login)
- firing function at login within class
- WP-admin or any other is redirecting me to (This page doesn’t seem to exist.)
- How to allow WordPress updates to only one specific administrator?
- wp-login not found – All usual solutions not working
- Is there a filter to edit html of user-edit.php
- Create new user from phpMyAdmin
- GoDaddy hosting wp-admin problem
- How do I make it so that the all users page is not a white screen?
- WP Admin Login keeps redirecting to login
- CPU overload spam – redirect link to wp-admin and new post
- Newly created user role not displaying on users screen
- How to check if a user is in a specific role?
- On Users (user.php) in wp-admin disable/hide “Bulk Actions” and “Change Role To”
- How can I can I make changes to a WP project I pulled from GItHub?
- WordPress Admin Login Issue
- How to log into WordPress via GET/POST
- Hook into form handle from admin users table
- restrict admin panel sections to users
- wp-login.php entering password nothing happens
- Trying to login to my site redirects me to the first page
- CSRF attack to create USER
- stop customize.php redirect to login page if admin is not logged in
- Admin Login Checks
- WordPress logged in but no access to wp-admin
- Changed the path to wp-login and now can’t access WPress dashboard
- Why my login panel has a wrong language?
- Handling multiple account logins?
- How to keep the plugin submenu open on viewing a custom version of users.php?
- WordPress Login for multiple sites
- is_admin() conditional statement
- Admin Login page not working at all
- Anyone Can Register
- Impossible User Registration
- Couple questions about .htaccess, login page, updates
- Is it possible to tell if a user is logged into WordPress from looking at the cookies which are set?
- Extend user search in the users.php page to allow for searching by role and excluding specified email domains from the “users search” input box
- Extend user search in the Wp backend area on the users.php page to allow for searching by email domain and role from the “users search” input box
- WordPress Users page missing user count next to different types of users
- After Upgrade: $user becomes unknown (id: 0) after successful login?
- Redirect users based on their roles, is_admin()
- Searching for a custom meta from user.php in the admin
- WordPress site shows a white page for site/wp_admin. A login returns again to the login screen