Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • I had the same problem with the login loop, and noticed that if the “remember me” option was checked, it worked. Using the “Snippets” plugin, I added this code to fix it by always checking the option, then hiding it so it can’t be unchecked.

    add_action(
        'init',
        function() {
            add_filter(
                'login_footer',
                function() {
                    echo "<script type='text/javascript'>document.querySelector('#rememberme').checked = true; document.querySelector('.forgetmenot').style.display = 'none';</script>";
                }
            );
        }
    );
    • This reply was modified 5 years, 6 months ago by voicefeed.

    We do use a plugin called Network Subsite User Registration which seemed like a possible conflict, but disabling it had no effect on the problem.

    It’s a multisite installation, using the sub directory option, not sub-domains.

    There are no error messages on screen, or in the PHP error log.

    Can’t log in the second time, either – it always reloads the login page.

    Immediately after submitting the login form, the browser’s URL line changes to wp-admin, but then pops back into the login page as if there’s no cookie set.

    This is with PHP 7.0, so I assume it’s trying to use the polyfill code to set the cookies.

    Having the same issue. Trying to log in with a redirect to the wp_admin page just reloads the login form again.

    Thread Starter voicefeed

    (@voicefeed)

    Thanks, Justin – I just went and tested for the problem again, and now it seems to be working fine! It may have been some kind of plugin conflict, I suppose. If I find out what was going on I’ll post an update to let you know. Thanks for checking this out.

    Thread Starter voicefeed

    (@voicefeed)

    Hi Justin,

    Yes, the auth_cookie_expiration filter is actually in a custom plugin that’s enabled for the whole network. I checked to make sure the filter was being executed by writing a note to the PHP error log in its function, when logging in on a subsite, and it is definitely executing – but the cookie is always set to expire at the end of the session.

    Here’s the filter code I’m using – it’s very simple, and does work when logging in at the root site.

    
    add_filter(
    	'auth_cookie_expiration',
    	function() {
    		return 31556926; // 1 year in seconds
    	}
    );
    
Viewing 5 replies - 1 through 5 (of 5 total)