WordPress Authentication: Cookies & Sessions

WordPress uses a robust authentication system that leverages both cookies and sessions to ensure a seamless and secure user experience.

Cookies

After User enters credentials for login and if the credentials are correct, WordPress generates two primary cookies:

  • wordpress_[hash]: This cookie stores authentication details and is limited to the “/wp-admin/” directory, ensuring secure access to the admin area.
  • wordpress_logged_in_[hash]: This cookie identifies the logged-in user and maintains the session across different pages Logged-in cookie is typically set to persist for a certain duration, allowing users to remain logged in even after closing their browser.

Read more about WordPress cookies here: https://developer.wordpress.org/advanced-administration/wordpress/cookies/

Sessions

While WordPress primarily relies on cookies, it also leverages a limited form of server-side session management for specific functionalities like the admin bar and comment submission. It implements session expiration to enhance security.

If a user is inactive for a specified period, their session will automatically time out, requiring re-authentication.

Let’s have a Technical Deep Dive into WordPress Authentication Cookies & Sessions. In this exploration, we’ll learn how WordPress manages sessions and its associated issues.

How WordPress uses Authentication Cookies & Sessions