WordPress Login Redirect Loop: Fix Being Sent Back to wp-login
You type the right password and WordPress sends you back to the login page. The cause is usually cookies, address settings, caching…
The debug log names the file and line behind many WordPress errors. Learn to turn it on safely, read what it says and switch it off when you are done.
The WordPress debug log is a text file where WordPress records PHP errors, warnings and notices instead of showing them on the page. When a site shows a white screen, a critical error or a feature that silently fails, the log often names the exact file and line behind the problem, which is usually inside a plugin or a theme. This guide shows how to turn the log on safely, read the entries, act on what you find and, importantly, turn it off again, because a debug log left on can leak information.
Add three lines to wp-config.php: turn on WP_DEBUG, turn on WP_DEBUG_LOG and set WP_DEBUG_DISPLAY to false so errors go to the file and not to visitors. Reproduce the problem, open wp-content/debug.log and read the newest entries at the bottom, looking at the file path and line number. When you have the information, turn debugging off and remove or protect the log file. Do this on a staging copy if you can, and back up first.
How this guide was prepared: it is research-based. We used the WordPress debugging documentation and the Site Health documentation listed under Sources, checked on October 23, 2026. We did not read your log, and the log content depends on your site, so treat the steps as a safe method, not a guaranteed fix.
The WordPress debugging guide describes the constants involved. WP_DEBUG turns on debug mode and defaults to false. WP_DEBUG_LOG saves errors to wp-content/debug.log (or to a path you give) and requires WP_DEBUG. WP_DEBUG_DISPLAY controls whether errors appear in the page, defaults to true, and should be set to false when you want to log without showing errors to visitors. The guide calls these tools meant for local testing and staging, and advises backing up or using a staging copy before changing a site. WordPress’s own Site Health screen warns when errors are logged to a potentially public file, and when errors are displayed to visitors, because debug output can contain sensitive information.

Use the log when something fails without a clear reason. For a site that is down, a critical error often shows an admin email with details; see WordPress critical error: recover your website safely. Take a backup before you edit wp-config.php; see is your WordPress backup really safe.
Open wp-config.php and add these lines above the line that says to stop editing:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );Use the boolean true or false without quotes, because the guide warns that a quoted 'false' is read as true. Save, and keep a note of the time you turned it on.
Do the thing that fails (open the page, press the button, run the import) so WordPress writes entries about it. A log full of old notices is hard to read, so if the file is already large, rename it first so that you start with a clean one.
Open wp-content/debug.log in your file manager or over SFTP and go to the bottom. Entries carry a date, a type such as Fatal error, Warning, Notice or Deprecated, a message and a file path with a line number. The most useful line for a break is usually a fatal error. A path containing wp-content/plugins/plugin-name or a theme folder points at the code that was running, which is not always the root cause, but it tells you where to start. Notices and deprecation messages are usually harmless noise unless they match your problem.
Update the plugin or theme, replace it, or send the developer the exact message and line. If a plugin is the cause, see how to find the plugin that broke your site and WordPress plugin conflict. For a memory message, read Allowed memory size exhausted. When you share log lines, remove file paths that reveal private details and never share passwords or keys.
When you have what you need, set WP_DEBUG to false, remove the extra lines and delete or move debug.log. The log can contain file paths and other details you do not want public, and it sits in a web-accessible folder by default. Leaving debugging on in production also costs performance.
wp-content.WP_DEBUG_LOG option accepts a custom path outside the public folder, which the guide describes.WP_DEBUG_DISPLAY true on a live site.'false' in quotes.By default in wp-content/debug.log once WP_DEBUG_LOG is on and something has been logged.
No. It can expose information and slow the site. Turn it off after use.
Nothing has been logged yet, writing may be blocked, or the problem is not a PHP error.
Not necessarily. Many warnings and notices are harmless, so match entries to the problem you are chasing.
Turn the log on briefly, reproduce the problem, read the newest entries and then switch it off. If the log points to something you cannot fix, wpallsolution offers plugin support and an emergency WordPress fix. We cannot promise a result without seeing your log and setup.
You type the right password and WordPress sends you back to the login page. The cause is usually cookies, address settings, caching…
Most break-ins start at the login screen. Use this practical checklist for passwords, two-step login, admin accounts, attempt limits and HTTPS.
A staging site lets you test updates on a copy before customers see them. Learn how to create one, lock it down…
Black FridayCyber Monday sale
Before you go,
Our biggest discount of the year on the first payment of every maintenance plan.
BF2026 at checkout