First thing I did was search Google, of course, for WordPress wp-login redirect loop. Suggestions of resetting browser cache and the like didn’t help, so I checked the error logs and found this:
WordPress database error Duplicate entry '0' for key 'PRIMARY' for query INSERT INTO `wp_usermeta`
Turns out the issue was a few of the WordPress tables somehow didn’t get set to AUTO_INCREMENT. Figuring out which ones was a matter of checking a correct database and mimicking that.
The two for me were wp_users and wp_usermeta. Here’s how I fixed it using PHPMyAdmin:
- Open the Database with PHPMyAdmin and click on the wp_users table
- Check if AUTO_INCREMENT is set to the ID column in Extra. If it is, then this post probably won’t help you:
Otherwise it will look like this:
- Click Edit/Change. You’ll see something like the image below. Check the A_I box and save.
- Check the rest of the tables for similar issues. Use a good database as reference. I had issues with wp_usermeta and wp_term_taxonomy
As a side note, this particular install was migrated from a Joomla install with a really ugly database. Possibly related.