instagram rss arrow-down

How To Fix WordPress Keeps Logging Out ProblemThis tutorial is part of our FREE WordPress Management training and WordPress Troubleshooting tutorial series.

In this series of step-by-step tutorials, we show you how to troubleshoot and fix common WordPress errors.


Important: Always do a backup of your WordPress site (files and database) before modifying any files or performing any upgrades or installations! 

If you don’t want to back up your files yourself, then get assistance from a WordPress professional, or use backup plugins.

Do you keep getting logged out of WordPress?

(Do you keep getting logged out of WordPress?)

WordPress places a cookie on your web browser to authenticate your log in session for security purposes. If it can’t verify or authenticate your session, it will log you out.

Mismatched URLs

If there is a mismatch between the cookie set for your website URL stored in your web browser and the address specified in your WordPress site settings, the authentication will fail, resulting in an error that will log you out of your session.

To avoid this error, your WordPress Address (URL) and Site Address (URL) fields should use the same prefix in the hostname (i.e. if you use ‘www’ in your site’s address, then both fields should display the ‘www’ in the URL).

To check that mismatched settings are not causing the issue, log into your admin area, then go to Settings > General Settings and make sure that both your WordPress Address (URL) and Site Address (URL) fields use the same URL prefix …

Mismatched URL prefixes can cause logouts

(Mismatched URL prefixes can cause logouts)

If your WordPress Address (URL) doesn’t match the domain prefix of your Site Address (URL), WordPress sees this as two different websites (e.g. one site with ‘www’ and another without the ‘www’).

Practical Tip

Note: We are not referring here to having a different WordPress Address (URL) than a Site Address (URL) if your site requires these to be different in order to work. What we mean is both URLs either must use ‘www’ in the prefix or both should use the ‘non-www’ version.

So, the settings below are OK …

These settings are OK

(These settings are OK)

And …

These settings are OK

(These settings are OK)

And …

These settings are OK

(These settings are OK)

The settings below, however, are mismatched and will lead to issues …

These settings are not OK

(These settings are not OK)

And …

These settings are not OK

(These settings are not OK)

And also …

These settings are not OK

(These settings are not OK)

If you need help configuring General WordPress settings or understanding what these settings mean, refer to the tutorial below:

If You Cannot Log Into WordPress

If you cannot log into your WordPress admin area or access your Settings section, then your login details need to be manually overriden.

This involves logging into your server using FTP or cPanel’s File Manager and editing your wp-config.php file. If you need help with this, refer to the tutorial below:

Important Info

The wp-config.php file is a very important WordPress file. If you don’t want to edit code in your WordPress installation files or don’t feel confident making changes on server files, then contact your hosting company or a professional WordPress technical support service provider for help.

How To Manually Override Your WordPress Login Details

Access your server using FTP or cPanel File Manager and locate your wp-config.php file …

locate your wp-config.php file

(wp-config.php file)

Right-click on the file and select ‘Download’ to save a copy to your hard drive …

Download wp-config.php to your hard drive

(Download wp-config.php to your hard drive)

Next, open up the wp-config.php file using a plain text editor (use your operating system’s built-in editor or an application like NoteTab).

Practical Tip

If you can’t see the file in your text editor browser, make sure to select ‘All files (*.*)’ in the ‘Files of type:’ menu …

Open wp-config.php using a text editor

(Open wp-config.php using a text editor)

Scroll down all of the code until you find a line that says “That’s all, stop editing! Happy blogging.” …

That's all, stop editing! Happy blogging.

(That’s all, stop editing! Happy blogging.)

Above this line, you will need to enter the following two lines of code (replace with your domain and make sure than both lines use either ther ‘www’ or the ‘non-www’ version) …

Add these lines to your wp-config.php file

(Add these lines to your wp-config.php file)

After typing in the two lines shown above, your wp-config.php file should look like the screenshot below …

Your edited wp-config.php file

(Your edited wp-config.php file)

Save the file and upload the modified wp-config.php file to your server, overwriting the existing file on your server …

Upload your edited wp-config.php file to your server

(Upload your edited wp-config.php file to your server)

After uploading the edited wp-config.php file to your server, you should be able to log into your WordPress site. Hopefully, this will fix the issue and the WordPress cookie will recognize that you are logging in from the same website, instead of seeing two different sites (one with ‘www’ and the other with no ‘www’).

Practical Tip

Hardcoding your login values into the site itself is not the best way to fix this problem, it’s just a way to get you back into your site if you are unable to login. With this method, you won’t be able to edit your site’s URL settings on the General settings page.

For more information on this method, including what to do if you run into problems, see the official WordPress technical documentation below:

In addition to the above, check out this video on how to fix the WordPress keeps logging out problem from the team at MyThemeShop:

(How to fix the WordPress keeps logging out problem. Video: MyThemeShop)

More WordPress Troubleshooting Tutorials

Check out the tutorials in the section below if you experience other issues or errors with WordPress:

How To Fix WordPress Keeps Logging Out Problem

(Source: Pixabay)


“Learning WordPress has been a huge stumbling block for me. I’ve been looking for something that covers absolutely everything but doesn’t cost an arm and a leg. Thank you so much … you have just provided me with what I have been looking for! Truly appreciated!” – Tanya

Disclaimer: WordPress and its related trademarks are registered trademarks of Automattic, Inc. This site is not affiliated with nor sponsored by Automattic, Inc. or the WordPress Open Source project. This site and the services and products offered on this site are not affiliated, associated, sponsored, or endorsed by WordPress, nor have they been tested, reviewed, or certified by WordPress. The owner, contributors and/or advertisers may derive financial benefit from sales of items reviewed, linked to, or advertised on this site.


Was this tutorial useful? Please feel free to use the social links below and share this information with other new website owners.

Author: Martin Aranovitch

Martin Aranovitch is the founder of and has authored hundreds of FREE WordPress tutorials for non-techies and beginners. provides detailed step-by-step tutorials that will teach you how to use WordPress with no coding skills required and grow your business online at minimal cost!

Source link

Support New Articles with a Sweet Tee

Leave a Reply
Your email address will not be published. Required fields are marked *