WordPress session expired: Guide To Fix It Quickly
parallax background

WordPress session expired: Guide To Fix It Quickly

How to Fix the Facebook Link Thumbnail Not Working Error
May 7, 2021
WordPress post missed schedule: How To Fix This
May 12, 2021

Few things can be more frustrating to a WordPress site user than to be logged out with no warning. It ruins productivity and raises stress levels, especially if it's a frequent problem. "WordPress session expired" are three words that no one wants to see.

Cookies authenticate every login session. Cookies are small amounts of data used to identify different computers and users to a computer network.

For example, cookies are created to remember you and your preferences on a website. This way you don't have to explain to that website what settings you want each and every time you visit.

Cookies are mostly to blame for the dreaded "WordPress session expired" error message. But there are some other possibilities.

This guide will show you how to troubleshoot and correct problems with WordPress timeouts.

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.

WordPress Session Expired Error Review

Few things are as stressful as when WordPress keeps logging you out. This guide has shown you why the "WordPress session expired" error happens and how to fix it.

Use these seven solutions to successfully resolve the 'session has expired' error.

  • Clear Your Browser Cache
  • Allow WordPress Sites To Save Cookies
  • Clear Your Other Caches
  • Restore Your Site From a Backup
  • Increase The Duration WordPress Remembers You
  • Check WordPress Site Settings
  • Troubleshoot WordPress Plugins

The proven solutions from this guide will make sure you can fix any WordPress session expired error. You’re one step closer to mastering all things WordPress.

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 230,000+ customers.