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…
If your site sends visitors to spam pages, act in order: contain, back up, check access and files, then clean and prevent. These are the first steps.
A WordPress redirect hack happens when attackers change your site so that visitors, or only some of them, are sent to spam, scam or adult pages. It is stressful, but the first steps are clear: stop the damage, keep a copy, close the ways in, then clean and check. This guide covers those first steps. It is a starting point, not a full clean-up; if you are not comfortable working in files and databases, get help.
Take a backup of the site as it is now, so you keep evidence, and ask your host for help if you can. Change every password: WordPress admins, hosting, FTP or SFTP, and the database. Regenerate the secret keys in wp-config.php so existing logins stop working. Check .htaccess, index.php and your theme files, plus plugins and users, for things you did not add. Replace WordPress core with a clean copy, update everything, and scan again. Redirects may show only to some visitors, so test from a phone and a private window.
How this guide was prepared: it is research-based. We used the official WordPress “My site was hacked” guide listed under Sources, checked on October 23, 2026. We did not inspect your site, and every infection is different. We are a WordPress maintenance and development company, not a dedicated cyber-security firm.

Write down what you see and when it started. Take a full backup of files and the database for evidence, and label it infected so it is never restored by mistake. If a clean backup from before the problem exists, note its date. Consider putting the site in maintenance mode while you work, or ask your host to help isolate it.
Change passwords for all WordPress users, especially administrators, then your hosting account, FTP or SFTP users and the database user. Update wp-config.php with the new database password and fresh secret keys; changing the keys logs everyone out. Scan the computers that manage the site too, since stolen saved passwords are a common source. See WordPress login security.
Look at .htaccess for rules you did not add, and at index.php, header.php, footer.php and functions.php for odd code. The official guide suggests replacing the wp-admin and wp-includes folders with fresh copies from WordPress.org. If you have command-line access, WP-CLI can compare core files to the official checksums with wp core verify-checksums, and plugin files with wp plugin verify-checksums --all. Deleted core files can be restored with wp core download --force --skip-content, but make a backup first, as it overwrites core files.
Remove plugins and themes you do not recognise or no longer use, and reinstall the rest from trusted sources. Delete unknown administrator accounts; see WordPress user roles. Redirect code can also live in the database, for example in site settings or posts, so check the siteurl and home values and search for suspicious script tags. Be careful here, since mistakes can break the site.
Update WordPress, themes and plugins. Run a malware scan and retest from several devices. If Google flagged the site, fix it and request a review in Search Console. Then find the cause, such as an old vulnerable plugin; otherwise the hack returns. Read our PHP2Shell article to see what hidden backdoors can look like, and consider ongoing maintenance.
Attackers often hide it from site owners and show it only to visitors from search or on mobile.
Not by itself. Hidden files or accounts may remain and let the attacker back in.
A scanner helps to find problems, but manual checks are still important and no tool is perfect.
Only a backup taken before the infection, and then fix the cause and update immediately.
If your site is redirecting right now, contact our emergency WordPress fix service. We do not promise a result in advance, because every infection is different. Contact us with what you see.
You type the right password and WordPress sends you back to the login page. The cause is usually cookies, address settings, caching…
Old PHP stops getting fixes, but a rushed update can break plugins. Learn to check your version, test compatibility and switch PHP…
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