Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

localhost for wordpress theme project file suddenly wants cookies enabled?

Hello. i am using the following url: http://localhost/allisongrace.com/wp-login.php?

to access wp admin for the wordpress themes project. tried a few different browsers and keep getting this error message:

ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.

except cookies are not blocked and i can log into other live wordpress admin sites. Any suggestions as to what's wrong?

I can access the website at: http://localhost/allisongrace.com/ just can't get into the admin.

thank you, Leslie

7 Answers

Andrew Thurston
Andrew Thurston
2,705 Points

Hi Leslie, I was dealing with the same problem all last weekend on my own local installation of Wordpress. You will receive an error if any PHP code is wrong in any of your files.

My error happened to be that there was there was white space after the closing php tag in a the functions.php file (Whitespace PHP error explanation)

I suggest you do the following:

1) Open up wp-config.php and goto line 81 where it says the following:

 *define('WP_DEBUG', false);*

Change this to be:

  *define('WP_DEBUG', true);*

This will turn the debugger on and allow PHP to display errors that are thrown (you don't want to have this on for a client's live site).

2) Now try to sign in again as an admin on your local install of WP 3.8, there should display an/multiple error message/s of exactly where (in what file and on what line) your PHP needs fixing.

Hope that helps!

EDIT: Markdown syntax -- whew finally got it!

  • Andy

Thanks for this! I had whitespace in my functions.php file.

Hello Zac,

Since i can't access admin panel, I attempted to disable the theme by change the name of the folder and then by moving the folder out of the theme folder. This either gave no change or a blank white screen. suggestions? Could something in my coding create this?

Thank you

Thank you Hayden for the help.

Tried what you suggested above. Read through a lot of the tread at the link. sigh. i am using 3.8 and it was working fine until i closed out for the night (after working fine for a few nights) and then attempted to access the localhost again.

When i added the fix to the functions.php file. nothing changed. when i commented out the code in the wp-login.php file, it then did not throw the error message, though it landed on a blank white screen. so not too helpful either.

Some comments (in the thread link) said that when they entered their login info again, it by passed the message. no such luck.

Please let me know if you have any other suggestions. thank you, Leslie

Hayden Taylor
Hayden Taylor
5,076 Points

I know this isnt a great answer but it might stop you from wasting your time.

" Everyone is having this issue. The only solution is to delete your site, destroy your computer and move to the jungle and live off the grid.

But seriously... this "loging Cookies blocked" error seems to be caused by the v3.8 upgrade and I believe most, if not all, users are having the problem.

None of the prescribed fixes work according to many threads (i.e., removing plugins, commenting out lines of code in the login.php page, etc.) and all we can do is wait for an update fix from wordpress."

http://wordpress.org/support/topic/error-cookies-are-blocked-or-not-supported

I will keep looking into this issue and post back if I find anything new. Best chance it a wordpress update it will most likely roll out soon.

not sure how this works. so posted same things twice and can't see how to delete it.

Thanks again, Hayden. Africa here i come!

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Does it make a difference if you disable the project theme?

Hayden Taylor
Hayden Taylor
5,076 Points

Are you using an up to date version of wordpress? I remember hearing about this issue awhile ago. After doing some searching google...... I came across

In function.php of theme I added:

//fix for cookie error while login. setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN); if ( SITECOOKIEPATH != COOKIEPATH ) setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);

The entire thread of solutions is --> http://wordpress.org/support/topic/cookie-error-when-logging-in

Although that thread is related to VERSION 3.7 and Wordpress is now on 3.8.

If you are using the most up to date version of Wordpress please comment back.

This is also the other fix but tampers with CORE files which will screw up the next time you update Wordpress. Its a quick fix

First of all, how to get logged in again. Comment out lines 744-746 in wp-login.php . It should look like this:

// if ( isset($POST['testcookie']) && empty($_COOKIE[TEST_COOKIE]) ) // $user = new WP_Error('test_cookie', _("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress.")); // else $user = wp_signon('', $secure_cookie);