WordPress session expired: Guide To Fix It Quickly
parallax background

WordPress session expired: Guide To Fix It Quickly

The Ultimate Website Design Checklist For Designers
May 10, 2024
WordPress post missed schedule: How To Fix This
May 12, 2024
The Ultimate Website Design Checklist For Designers
May 10, 2024
WordPress post missed schedule: How To Fix This
May 12, 2024

A sudden interruption in your workflow—nothing frustrates more than the WordPress session expired error. Picture this: you're in the middle of an important update, and bam, you're logged out. This common WordPress error disrupts productivity and can leave you scratching your head, wondering what went wrong.

In this guide, I'll walk you through how to fix the WordPress session expired error, ensuring you get back to seamless web management. Addressing this issue is not just about solving an immediate problem; it's about fortifying your site's reliability and user experience.

By the end of this article, you'll master troubleshooting WordPress session timeouts, resetting session cookies, and configuring server-side settings. We’ll dive deep into essential SEO entities like structured data and technical SEO adjustments, all geared towards resolving these pesky session management issues.

Get ready to explore actionable steps, from clearing browser cache to optimizing PHP session settings, ensuring your WordPress site runs smoothly without disruptions.

What Causes A WordPress Session Expired Issue?


No matter what the problem is, to fix it requires understanding it. When WordPress keeps logging out, we need to know the underlying mechanics in order to correct the error.

The root of this error lies in the WordPress login process. WordPress puts an authentication cookie in your browser at the beginning of a login session. This cookie is designed to match the WordPress Address URL from your settings.

If they do not match, such as if you attempt to access a WordPress address URL that isn't in your WordPress settings, the session can't authenticate. Instead, you will be logged out and presented with the troublesome "WordPress session expired" alert.

There are several possibilities that cause cookie-related errors. This guide will present proven solutions. We suggest following this guide chronologically for the quickest and easiest fixes.

Most Efficient Ways To Fix The Issue

Clear Your Browser Cache


The simplest and first solution to attempt is based on your own browser. If the WordPress page has been previously cached, your browser could be trying to use an old cookie to authenticate the session.

If so, clear your browser's cache and this will resolve the problem.

Allow WordPress Sites To Save Cookies


Another browser-related cause of this error can be found in your browser settings. If your browser is blocked from accepting cookies, WordPress won't be able to use session cookies and will log you out repeatedly.

Permit Chrome To Save Cookies

  • Open your Menu Options (the three dots icon in the upper right)
  • Go to Settings > Advanced
  • Click on Content Settings
  • Enable the Allow Site To Save and Read Cookie Data option

Permit Firefox To Save Cookies

  • Go to Settings (The gear icon in the upper-right)
  • Click on Privacy and Security
  • Scroll to Cookies and Site Data
  • Enable the Accept Cookies and Site Data option.

In either browser, log in to your WordPress site to test if the expired session error continues.

Clear Your Other Caches


If the error is still occurring, we can rule out your browser as the culprit. Instead, we need to examine your WordPress site cache. It may be behind why WordPress keeps logging out.

Clearing out your WordPress cache can resolve error-causing conflicts, but his process is different from host to host. Communicate with your own host to get instructions on how this can be done in your case.

Likewise, if you're utilizing a caching plugin on your site, its cache may be why WordPress keeps logging out. Check the plugin documents for solutions.

Restore Your Site From a Backup


It's good practice to make regular backups of your website.

Occasionally a plugin may have changed the code of your WordPress architecture itself. This change could be what is now causing WordPress to keep logging out.

Restore your website from one of your previous backups. it will revert the code to a time before the change. This will correct errors related to codes changed by plugins.

Increase The Duration WordPress Remembers You

WordPress sessions are programmed to timeout after 48 hours. This timeout won't be the cause of frequent "WordPress Session Expired" errors, but changing it can reduce unneeded logins.

To extend the duration of a WordPress session you must create a child theme and modify the functions.php file. This is an advanced procedure to do correctly. Many things can go wrong and if you have multiple users it can create security concerns.

Before Creating a Child Theme

  • Create a site backup
  • Consult a WordPress expert
  • Prepare troubleshooting methods

After creating the child theme, you will need to modify your functions.php file to extend the WordPress session duration

To modify the functions.php file:

  • Log in to the WordPress Admin Dashboard
  • Mouse over Appearance
  • In the dropdown, click Theme Editor. The theme code will open.
  • Find the functions.php file and open it. It will be at the top of the Themes File section, on the right-hand side.
  • Add the following code to the very bottom:
add_filter(‘auth_cookie_expiration’, ‘keep_me_logged_in_for_1_week’ );
function keep_me_logged_in_for_1_week( $expirein ) {
return WEEK_IN_SECONDS; // 1 week in seconds}
  • Click Update File to save

This code will extend your WordPress login duration to one week, but it can be made even longer. Replace the word "week" in the code with either "month" or "year" to extend it even further.

Check WordPress Site Settings


There are two fields inside your WordPress Settings that are key to allow authentication cookies to function. These are the Site Address and WordPress Address fields. Both should have either a www or non-www URL.

To edit these, log in to your WordPress dashboard. Then go to Settings > General.


If you can't edit them from there it means you don't have admin access. They can also be updated by editing the wp-config.php file.

  • Use an FTP client to connect to your website.
  • Go to your website's root directory
  • Find the wp-config.php file.
  • Download the wp-config.php file
  • Open it in a text editor, such as Notepad.
  • Depending on your preferred URL, add one of the two following passages of code just before the line that reads, "That's all, stop editing! Happy blogging"
    For non-www URLs use:
    For www URLs use:

    Replace example.com with your site address.

    Once both URLs are using identical addresses any issues caused by their conflicting URLs will be resolved.

    Troubleshoot WordPress Plugins


If WordPress still keeps logging out repeatedly then the issue may be related to your plugins.

Plugins may also need to authenticate sessions with a cookie, but improper setup or plugin cookie issues could cause WordPress session timeouts.

Troubleshoot this by disabling your plugins one at a time. If the problem goes away while a particular plugin is disabled then that plugin is the cause of the error.

If the feature that the plugin provided is critically needed, search for an alternative. If there are none, report the issue to the plugin's creator and ask for a fix.

FAQ about the WordPress session expired error

Why does the WordPress session expired error occur?

This error happens when the session cookies become invalid or corrupted. It can be due to mismatched server settings, browser issues, or problems with the WordPress session management. Often, clearing the browser cache or resetting the session variables can resolve the issue.

How can I clear my browser cache to fix this error?

Clearing the browser cache is simple. Go to your browser settings, find the option for cache or browsing data, and clear it. This can resolve session cookie issues and fix the WordPress login expired problem. Make sure to refresh your site afterward.

What plugins can help manage WordPress sessions?

Several plugins can help manage and optimize WordPress session handling. Look for plugins like "WP Session Manager" or "Session Keeper" which handle session duration and settings, reducing the likelihood of session expired errors. These tools ensure your WordPress user session remains active longer.

How do I adjust PHP session settings to prevent this error?

Adjusting PHP session settings can stabilize your sessions. Access your php.ini file and increase the session timeout settings. This helps in managing server-side sessions more effectively, thus preventing frequent WordPress session timeout errors and improving overall session management.

Can changing my theme affect session expiration?

Yes, certain themes can affect session management. Themes with poorly coded elements can interfere with session cookies. If you encounter persistent issues, try switching to a default WordPress theme to see if it resolves the WordPress session expired problem.

What role does two-factor authentication play in session management?

Two-factor authentication (2FA) adds an extra layer of security but can sometimes lead to session expiration issues. Ensure your 2FA settings are properly configured and compatible with your WordPress authentication methods to avoid unnecessary session terminations.

How can I check if my hosting provider settings are causing the error?

Hosting settings can impact session management. Check with your hosting provider to ensure that your server settings are optimized for WordPress session handling. Misconfigured server settings can cause session cookies to expire prematurely.

What is the role of user roles and permissions in session expiration?

Incorrect user roles and permissions can lead to session issues. Ensure that each user role is correctly assigned and configured to avoid unnecessary session terminations. Proper management of user permissions helps maintain stable sessions.

How do I resolve session expired errors caused by plugin conflicts?

Plugin conflicts often cause session expiration issues. Deactivate all plugins and reactivate them one by one to identify the culprit. Ensure all plugins, especially those related to session management or login settings, are up-to-date and compatible.

Can clearing the WordPress cache resolve session expiration issues?

Yes, clearing the WordPress cache can often fix session expiration errors. Use caching plugins like W3 Total Cache or WP Super Cache to clear the cache. This can resolve session cookie issues and restore proper WordPress session functionality.


You've navigated the maze of how to fix the WordPress session expired error. This guide equipped you with essential tools and knowledge, from clearing browser cache to adjusting PHP session settings.

In summary:

  • Browser cache: Clearing it resolves session cookie issues.
  • Plugins: Use them for better WordPress session management.
  • PHP settings: Adjust for optimal server-side session handling.
  • Themes: Check if your theme disrupts session cookies.
  • 2FA: Proper configuration prevents session problems.
  • Hosting settings: Ensure compatibility for smooth session management.
  • User roles: Proper permissions maintain stable sessions.
  • Plugin conflicts: Identify and resolve to prevent session errors.
  • WordPress cache: Clearing it restores session functionality.

By following these steps, you can ensure a smoother, more reliable WordPress login experience. Tackle those pesky session expired errors head-on, enhancing both your SEO and user satisfaction.

If you enjoyed reading this article on WordPress session expired, you should check out this one about WordPress updating failed error.

We also wrote about a few related subjects like failed to load resource error, WordPress posting to Facebook done automatically, how to reorder pages in WordPress and WordPress failed to import media.

Albert Ślusarczyk
Albert Ślusarczyk
As the co-creator of Be Theme, I am a strong believer in designing with care and patience. I pour my energy, time & knowledge into perfecting the theme for our 260,000+ customers.
Siteground Hosting