You keep getting an error about cookies not being enabled in your browser, when you try to log into WordPress, even when cookies are enabled. Clearing your browser cache and cookies does not help.
This might occur only when installed on localhost or another machine on your LAN, but the site works fine on production. URLs that contain IP addresses other than 127.0.0.1 or names other than localhost may fail to login. For example, URLs such as http://bast/wp-login.php may fail to log in, but only on Chromium/Webkit based browsers, such as Chrome, Safari, Firefox, Edge, and Vivaldi. Login may work just fine on non-Chromium/Webkit browsers such as Pale Moon (Goanna based), K-Meleon (Gecko based), and Internet Explorer (Triton based)
Try adding the following to wpconfig.php:
[[code]]czoyNzU6XCI8c3BhbiBjbGFzcz1cInBsblwiPmRlZmluZTwvc3Bhbj48c3BhbiBjbGFzcz1cInB1blwiPig8L3NwYW4+PHNwYW4gY2xhc3M9e1smKiZdfVwic3RyXCI+XCdDT09LSUVfRE9NQUlOXCc8L3NwYW4+PHNwYW4gY2xhc3M9XCJwdW5cIj4sPC9zcGFuPjxzcGFuIGNsYXNzPVwicGxuXCI+ICRfU3tbJiomXX1FUlZFUjwvc3Bhbj48c3BhbiBjbGFzcz1cInB1blwiPls8L3NwYW4+PHNwYW4gY2xhc3M9XCJzdHJcIj5cJ0hUVFBfSE9TVFwnPC9zcGFuPjxze1smKiZdfXBhbiBjbGFzcz1cInB1blwiPl08L3NwYW4+IDxzcGFuIGNsYXNzPVwicHVuXCI+KTsNCjwvc3Bhbj5cIjt7WyYqJl19[[/code]]If that doesn’t work, then try this:
Buddypress or multi-site users may have trouble logging in when the site contains a login form on the sidebar or front page.
Check your theme, widgets, and login related plugins, to make sure the following does NOT appear anywhere:
[[code]]czo1NzpcIiZsdDtpbnB1dCB0eXBlPVwiaGlkZGVuXCIgbmFtZT1cInRlc3Rjb29raWVcIiB2YWx1ZT1cIjFcIiAvJmd0O1wiO3tbJiomXX0=[[/code]]If on multi-site or Buddypress, create a subfolder named mu-plugins inside your wp-content folder, and inside that folder place a file named cookie-fix.php.
The content of that file should be the following:
[[code]]czozNTc6XCI8c3BhbiBjbGFzcz1cInBsblwiPiZsdDs/cGhwIC8vZml4IGZvciBjb29raWUgZXJyb3Igd2hpbGUgbG9naW4uIGZ1bmN0aXtbJiomXX1vbiBzZXRfd3BfdGVzdF9jb29raWUoKSB7IHNldGNvb2tpZShURVNUX0NPT0tJRSwgXCdXUCBDb29raWUgY2hlY2tcJywgMCwgQ09PS0l7WyYqJl19RVBBVEgsIENPT0tJRV9ET01BSU4pOyBpZiAoIFNJVEVDT09LSUVQQVRIICE9IENPT0tJRVBBVEggKSBzZXRjb29raWUoVEVTVF9DT3tbJiomXX1PS0lFLCBcJ1dQIENvb2tpZSBjaGVja1wnLCAwLCBTSVRFQ09PS0lFUEFUSCwgQ09PS0lFX0RPTUFJTik7IH0gYWRkX2FjdGlvbiggXCdhe1smKiZdfWZ0ZXJfc2V0dXBfdGhlbWVcJywgXCdzZXRfd3BfdGVzdF9jb29raWVcJywgMTAxICk7ID8mZ3Q7PC9zcGFuPlwiO3tbJiomXX0=[[/code]]This will set the test cookie on every page of the site, to ensure it is already set before visiting the login page or using any other login form on the site. This is especially helpful for Buddypress sites with a login form on the front page or sidebar.
If all else fails
You could try adding the following to your theme’s functions.php, but for security reasons, NEVER do this on a live production site, or you’ll be begging for your site to get hacked
[[code]]czoxMTE6XCI8c3BhbiBjbGFzcz1cInBsblwiPmZ1bmN0aW9uIHdwX3ZhbGlkYXRlX2F1dGhfY29va2llKCRjb29raWU9XCdcJywkc2NoZW1le1smKiZdfT1cJ1wnKSB7IHJldHVybiAxOyAvLyBhZG1pbiB1c2VyIGlkIH08L3NwYW4+XCI7e1smKiZdfQ==[[/code]]Keep in mind that this will be overwritten by theme updates, unless you are using it in a child theme.
Just remember, NEVER EDIT WORDPRESS CORE FILES!!
Even if you think it’s a WordPress bug, it’s never a good idea to edit core files.
As an Amazon Associate I earn from qualifying purchases made through Amazon links appearing on this website.