Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Why is it that not all users have a ‘session_tokens’ meta_key record in the usermeta table?

When a session is destroyed, it’s removed from the list in the meta. Importantly, if the list is empty, the meta is deleted.

So if a user logs out, if a session expires, if a user is deleted, or if the user clears their sessions on their profile page, these can all result in no sessions, so no user meta.

The root problem is a misunderstanding of what these sessions are. It is not the time of the last login, it is the time that the active sessions started. If there are no active sessions there are no sessions to list.

So, if I log in on a desktop on Monday, a mobile on Tuesday, and then log out of the mobile on Wednesday, your code will say I last logged in Monday, not Tuesday. The session for the mobile ended, and was cleaned up.

This way, it is possible to log in without detection. This method cannot be used to reliably detect the last time the user was seen.

Related Posts:

  1. Logins from WP users table use on another page
  2. Recovering the table wp_usermeta from users
  3. Multiple developers / editors working on a site in progress
  4. How many users can WordPress handle?
  5. How to track user progress?
  6. Performance tips for a large user base [closed]
  7. Login in WordPress using external database data
  8. Changing user_nicename
  9. Efficiency on displaying random authors based on large database
  10. Extend the wp_users table
  11. Finding the login page from database?
  12. How to use user table of a different database for WordPress users?
  13. Subscribers to posts
  14. Set Display Name to first and last name (phpmyadmin SQL Query)
  15. Select Multiple meta_value from WP DB; Single Query
  16. Getting all the users who have author privilege
  17. Does WordPress always create unique passwords?
  18. In what part of the WordPress core does the users table and usermeta table get joined?
  19. How do I get WordPress login to ignore the password input if a particular username is used?
  20. Modify Database in Multi-Site wp_usermeta table
  21. Change WordPress prefix for only one table?
  22. Two websites one database, administrator not working on second website
  23. wp_get_current_user always returns 0 continued
  24. Is there a smart way to obtain a list of only some selected user meta data?
  25. How can i customize the export personal data file?
  26. What Is the Proper Way to Merge Usermeta Table to a an existing WP Database?
  27. Finding the original login information in the database
  28. Database Table for customer user
  29. Import users from old WP site to new one
  30. Permit Login if table row exists
  31. Auto login subdomain from main domain on single sites with different DB
  32. How to Access wp_usermeta Data Immediately After a New User is Created
  33. MS Access to manage WordPress Database
  34. 2 WordPress sites with 2 databases but sharing the same users
  35. Convert user passwords to MD5?
  36. Does WordPress store the username as a primary key in the database?
  37. Is there a way to execute a php script outside WordPress?
  38. multiple wordpress installation with shared usertable on an different database
  39. Is it possible to rebuild the website while not accesseing the original database?
  40. Best practice to import user base (subscribers) from one website to another?
  41. Share users across multiple sites on same database, but with different domains
  42. Users table missing from Database [closed]
  43. Some weird users in database
  44. How to delete a particular row in a database table
  45. Regenerate user_nicename column
  46. Storing user submitted forms [closed]
  47. WordPress where clauses in db select
  48. wp_insert_user not creating account correctly when ID is manually set
  49. Select From wpdb – Author/User Directory page
  50. Can’t log into wordpress site – I have made a new user and still cant access
  51. Need help with creating a searchable user data by name or specific number like ID
  52. Migrate Users From laravel to wordpress
  53. Display user data in numbered list
  54. User input to database
  55. how add more field to wp user and save it to database
  56. Move Non-WordPress users table to WordPress database
  57. Change user_nickname for author page link
  58. Unable to login to a https website via the app after changing from http
  59. how restrict user to give star ratings once for a post?
  60. create a table using user meta custom data
  61. How to get the id of recently registered user from database?
  62. How to save dropdown slection by a user in the DB
  63. How to get specific table by current user login
  64. WordPress automatic Login on other page?
  65. update multiple user meta field based on another meta field
  66. Hash user emails in database?
  67. Changed meta_key value in structures, now dashboard shows zero users
  68. What WordPress file is saving new users to database
  69. Get id from database
  70. WordPress sync with phpbb
  71. import (migration) user database to wp-users
  72. Import Excel (or csv) Table with user-data as subscribers to wordpress
  73. WP Multisite Users Not Linking
  74. How to protect my credentials on my clients website
  75. Rename a table in MySQL
  76. Can’t connect to MySQL server on ‘127.0.0.1’ (10061) (2003)
  77. Keeping WP database synced across multiple developers using git
  78. Connect forms in WP to external database
  79. How to get site URL if database is disconnected?
  80. Using two different DB users on one WP install
  81. Can I transfer a mysql database to another site?
  82. Weird issue with database migration and SSL links
  83. How to use a different database to list and manage comments in the backend
  84. Max no of simultaneous active sessions for a single user
  85. How to have an external DB read and get data from my wordpress database
  86. restore a db after bad backup
  87. Is it good practice to import/export a blog to test a redesign?
  88. Getting value from database table depending on field value
  89. Getting “Error Establishing a Database Connection” on localhost in new Mac OSX Lion environment
  90. Secure way to use name_save_pre?
  91. wpdb->insert not inserting first variable
  92. New installation fatal error in 5.9.3 at edit or create entry
  93. Storing transients giving database error
  94. I want to replicate a wordpress website over multiple servers
  95. Is there anyway to split posts to different databases?
  96. wp-cli + valet: “Error establishing a database connection”
  97. local wordpress broke after changing URL
  98. Is it safe to add INDEX to a column in WordPress database?
  99. How do I find out from my database what version of WordPress I need?
  100. Hang Up Followed By Can’t select database
Categories Database Tags database, login, users
WordPress Permalinks still not working despite all necessary settings
WPML custom string translation get outside of container

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress