• jrshor

    (@jrshor)


    I have the PHP code posted in the header of my theme. When I first open my browser and try to login, it redirects me to the login page and says “ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.” After I enter my login information again, it logs me in a redirects me to my website. This only happens after I try to login for the first time since opening my browser. I’ve tried logging in on several different browsers on my computer, as well as other computers. Any reason for this? My site is https://upmc.coop/test/

    https://www.ads-software.com/plugins/wp-login-box/

Viewing 7 replies - 1 through 7 (of 7 total)
  • vnairp11

    (@vnairp11)

    I am having the same issue on my site im running the latest 3.7 version of wordpress please help thanks.

    same problem with wp 3.8

    Same problem with wordpress 3.8 Would appreciate a fix ??

    @origamifreak2: If you require assistance then, as per the Forum Welcome, please post your own topic.

    This topic references an old version of WordPress.

    I found a solution to this problem on this page. It seems to be a problem with how the newer versions of WordPress test for cookie support. There’s several examples of code to fix the problem in the comments. The code I used was from Cam on the second page. To make it work for the plugin I just modified the “add_action()” parameters to be “add_action( ‘init’, ‘set_wp_test_cookie’);” and then pasted it in plugin.php right above the rest of the functions on about line 107.

    function set_wp_test_cookie() {
    	setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN);
    	if ( SITECOOKIEPATH != COOKIEPATH )
    		setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);
    }
    add_action( 'init', 'set_wp_test_cookie');

    Origamifreak

    Sorry, not code savvy. Do you paste the full code you have there into the plugin.php file for this wploginbox plugin?

    Does it need to be before all functions, or just after the if user logged in function?

    For anyone having this problem, I found the easiest solution was to include the following in my themes functions.php:

    function set_wp_test_cookie() {
    	setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN);
    	if ( SITECOOKIEPATH != COOKIEPATH )
    		setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);
    }
    add_action( 'after_setup_theme', 'set_wp_test_cookie');
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Login Cookie Issues’ is closed to new replies.