We are a team of results-driven creative geniuses at PMGS Digital Agency that are enthusiastic about expanding your business and have the skills to do it.


How to solve WordPress keeps logging out problem

How to solve WordPress keeps logging out problem

Why does wordpress keeps logging out?

There are several primary reasons why WordPress keeps logging you out. Most commonly, you’re attempting to visit your site using a URL that does not match the one specified in your WordPress settings.

When you login to your WordPress website, a cookie is placed in your browser to validate the login session. The cookie is set for the WordPress URL that you have saved in your settings menu.

If these do not match, WordPress will fail to verify the session and you will be logged out.

This will also result in the too many redirect issues in WordPress.

Because the ‘WordPress Address’ and ‘Site Address’ in the image below are not the same, there will be a dispute.

site address conflict example

How to fix wordpress keeps logging out issue

The simplest solution to this login problem is to use the same URL in the ‘Site Address’ and ‘WordPress Address’ sections.

Navigate to Settings » General in your WordPress admin panel to do so.

general settings check urls

Then, double-check that the URLs are correct. In both boxes, you must provide either a ‘www’ or a ‘non-www’ URL.

Technically, ‘www’ is a subdomain in and of itself. This implies that URLs with and without ‘www’ are actually two separate domain names.

The issue will be resolved by altering and updating the URLs to the same location.

Then, be sure you click the ‘Save Changes’ option.

Adding Code to WordPress to Resolve the WordPress Keeps Logging Out Issue

If you can’t enter your WordPress admin area, you’ll need to manually change your wp-config.php file. This is a unique file that holds your critical WordPress settings.

You may accomplish this by using an FTP client or the file management tool in your WordPress hosting account control panel.

Then, in your site’s root directory, locate the wp-config.php file.

edit wpconfig file

You may save the file to your desktop and open it with your favourite text editor, such as Notepad. Then, above the line that reads, ‘That’s all, quit modifying!’, add the following code. ‘Good luck with your publishing,’ says the author.

php code

If you want to use www in the URL, then you can use the following code instead.

php code

Make careful to change the ‘’ URL with the URL of your own WordPress site.

The file must then be saved and uploaded back to your root directory.

When you log in to your website, WordPress should no longer lock you out.

We hope this post was useful in teaching you how to fix WordPress continues logging our problem.

If you think this article was useful to you, then stay tuned with us and subscribe to receive our blogs. If you wish to stay connected with us on social media, you can find us on Facebook, Instagram and LinkedIn