WordPress session expired: Guide To Fix It Quickly
parallax background

WordPress session expired: Guide To Fix It Quickly

Creative Writer Website Examples to Inspire You
March 10, 2023
Top Finance WordPress Theme Options to Use for Your Company
March 10, 2023

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.

FAQ about the WordPress session expired error

What does "session expired" mean in WordPress?

"Session expired" in WordPress means that the user's session has ended and they have been automatically logged out of their account. This usually happens when a user hasn't done anything for a while or when they try to do something that needs to be authenticated after their session has ended.

Why does WordPress say "session expired"?

The reason WordPress says "session expired" is to keep the user's account safe. If a user forgets to log out or stays logged in for too long, someone else could get into their account. WordPress helps stop this from happening by logging users out automatically after a certain amount of time when they haven't done anything.

How can I prevent the WordPress session from expiring?

You can keep a WordPress session from ending by using a plugin or by adding some code to the functions.php file of your site. "Keep Me Logged In" and "Session Expire Warning" are two well-known plugins that can help with this. You can also increase the session timeout in the wp-config.php file of your site.

How do I fix the "session expired" error in WordPress?

You can try to log in again to WordPress to fix the "session expired" error. If that doesn't work, you can sometimes fix the problem by clearing your browser's cache and cookies. If you still have problems, you might need to ask your web host or a WordPress developer for help.

How long does a WordPress session last before it expires?

Depending on how your site is set up, the length of time a WordPress session lasts before it ends can be different. By default, WordPress sessions end after 24 minutes of inactivity, but you can change this in your site's wp-config.php file by changing the session timeout period.

Can I change the duration of a WordPress session?

Yes, you can change how long a WordPress session lasts by changing the session timeout in the wp-config.php file of your site. To do this, you will need to add a line of code that sets the length of the session in seconds.

Do I need to log in again every time my WordPress session expires?

Yes, every time your WordPress session ends, you will have to log in again. WordPress automatically logs you out of your account when your session ends. This is done to protect your account.

Can I extend my WordPress session without logging in again?

Yes, you can extend your WordPress session without having to log in again if you use a plugin or add some code to the functions.php file of your site. But it's important to know that extending your session could make your account less safe.

What happens to my work if my WordPress session expires?

If your WordPress session ends while you are still working on something, you might lose any changes you haven't saved yet. To avoid this, you should save your work often or use a plugin that saves your work automatically as you go.

How can I check if my WordPress session has expired?

You can see if your WordPress session has ended by trying to do something that requires authentication, like accessing the WordPress dashboard or editing a post. If your session ends, you'll be asked to sign in again.

Ending thoughts on the WordPress Session Expired Error

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