How To Solve The WordPress Session Timeout Error

Rifat WordPress Tutorials Dec 11, 2021

If you're working on your website and suddenly WordPress keeps logging you out, you're likely to become frustrated. We usually see a notice with "Session Timeout Error," We are again on the login panel. Not only is re-entering your credentials every few minutes tedious, but it may also be time-consuming and hamper your productivity.

WordPress users frequently face this problem because of the cookies used to verify that you have permission to access the backend of your site. Luckily, the cure is generally straightforward.

I'll show you how to fix the WordPress constantly logging out the issue in this article. 

Let's get started!

Create Amazing Websites

With the best free page builder Elementor

Start Now

Solution 1: Clear Your Bowsing Data

The first option is to wipe your browser's cookies and cache. Your website may be seeking to validate your login credentials using an expired cookie.

This procedure may differ slightly based on the browser you're using. Take Chrome as an example because it's the most used browser. To begin, navigate to your browser settings by clicking the three-dot icon in the upper-right corner of the window:

Navigate to Privacy and Security > Clear Browsing Data. You can also follow More Tools > Clear Browsing Data.

Now make sure to check Cookies and other site data and Cached images and files. Then, move ahed with Clear Data.

Hopefully, your issue will be solved. But if you still encounter that, follow the next solution.

Solution 2: Cleaning Website Cache

If you're using a caching plugin to boost your websites loading speed, you may also need to empty your cache. This option is generally available in the settings of your caching plugin.

You can find a direct cache cleaning button on your plugin widget.

Solution 3: Browser Cookie Settings

It also sounds logical that your browser is set to reject cookies from your WordPress site, which is the reason behind the issue. Checking this issue will differ slightly based on the browser you're using. This section will show you how to find the correct settings in Chrome Browser.

Open the Privacy and Security settings.

From the Site settings option, look for Cookie and site data -

If it shows "blocked" under Cookie and site data, this is most likely the source of the WordPress keeps logging out the issue. Click Allow all cookies from the settings on the next screen after clicking on this section:

Hopefully, this will solve your issue.

Solution 4: WordPress Address and Site Address Matching Varification

If any of the solutions above don't work, it's possible that the cookies of your WordPress site do not match your Site Address. To test this, go to Settings > General in your WordPress dashboard and enter the following:

Under general setting, check Website address and site address, if both of them match, you are good to go.

Change everything that needs to be changed and save your settings. Then, if WordPress continues logging you out, you can put your WordPress Address and Site Address in your wp-config.php file instead.

To access it, you can use a File Transfer Protocol (FTP) software like FileZilla as well as your host's FTP connections. Connect to your server using your FTP program, and then look for wp-config.php in the public HTML directory:

Then paste the following code. That's all there is to it; no further modification! Congratulations on your publication:

define('WP_HOME','http://yoursite.com);
define('WP_SITEURL','http://yoursite.com);

Make sure to replace the URL's correctly with your website's address. Now save the file and try to login into your admin panel.

Solution 5: Plugin Error Troubleshooting

If none of the above methods have worked, the next step is to see if a plugin is causing WordPress to log you out regularly. For example, this could be the case if you have a plugin installed that uses cookies and have problems with them. To test your plugins, I propose that you set up a staging site where you can do it safely, away from your live site.

First, use the Bulk actions tool on the Plugins panel to disable all of your site's plugins:

Examine your site, as usual, to determine whether WordPress logs you out again or if the problem appears to be repaired. If you can stay signed in, you can re-activate your plugins one by one to identify which one is causing the issue to recur.

You can either delete the plugin and replace it with a similar utility or troubleshoot the problem further (perhaps with aid from the developer or the resources they've supplied) once you've identified which plugin is causing WordPress to log you out continuously.

You can disable all of your plugins via FTP if you can't access your WordPress dashboard for long enough. After connecting your client to your server, go to public HTML > wp-content > plugins:

Rename each plugin to deactivate them and changing the names back to the original one by one will re-activate the plugin.

Solution 6: Change WordPress User Remembering Duration

Now you can define that how long WP will remember you if you have checked the Remember Me box on the login screen.

There's no guarantee that this will solve WordPress's issue away from staying logged in. However, you can still view your dashboard for longer periods, which may be helpful while you investigate the root cause of the issue.

You can add the following code to the functions.php file of your theme (or a child theme, if possible) to accomplish this:

add_filter( 'auth_cookie_expiration', 'keep_me_logged_in_for_1_year' );

function keep_me_logged_in_for_1_year( $expirein ) {
    return YEAR_IN_SECONDS; // 1 year in seconds
}

If you like WordPress to remember users for a shorter time, you can use the DAY_IN_SECONDS, WEEK_IN_SECONDS, or MONTH_IN_SECONDS time constants.

When allowing users to stay signed in for long periods, keep in mind that it could be dangerous if someone were to access a user's computer while they were logged in. As a result, you'll need to carefully consider the benefits and drawbacks of the length of time you've selected.

Wrapping Up

While working on your site, logging out without any sign is really outrageous. To keep your workflow uninterrupted, these are some fast fixes you can attempt. This tutorial covered numerous possible options. Try them out, and let us know which one worked for you.

Divi WordPress Theme