Losing Session ID and sessionStorage when navigating to other domains on Multisite
Losing Session ID and sessionStorage when navigating to other domains on Multisite
Losing Session ID and sessionStorage when navigating to other domains on Multisite
Apparently I was missing the time() attribute. So when adding this to the expire option in the setCookie function, the cookie is being set. Code: setcookie(‘user-zipcode’, $zipcode, time() + MONTH_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN); setcookie(‘delivery-today’, $cookieVal, time() + DAY_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN);
The error message you see points to this part within the wp-login.php file: setcookie( TEST_COOKIE, ‘WP Cookie check’, 0, SITECOOKIEPATH, COOKIE_DOMAIN, $secure ); to its “path”, which is the 4th parameter: SITECOOKIEPATH If you check how that constant is defined, that is: define( ‘SITECOOKIEPATH’, preg_replace( ‘|https?://[^/]+|i’, ”, get_option( ‘siteurl’ ) . “https://wordpress.stackexchange.com/” ) ); meaning … Read more
First clear your browser’s cache (including cookies) and your server’s cache (cache plugins, etc.) Then set the following in your wp-config.php file: define(‘ADMIN_COOKIE_PATH’, “https://wordpress.stackexchange.com/”); define(‘COOKIE_DOMAIN’, ”); define(‘COOKIEPATH’, ”); define(‘SITECOOKIEPATH’, ”); Also, you may checkout the answer from HERE: define(‘WP_ALLOW_MULTISITE’, true); define(‘MULTISITE’, true); define(‘SUBDOMAIN_INSTALL’, false); define(‘DOMAIN_CURRENT_SITE’, ‘your-domain.example’); define(‘PATH_CURRENT_SITE’, “https://wordpress.stackexchange.com/”); define(‘SITE_ID_CURRENT_SITE’, 1); define(‘BLOG_ID_CURRENT_SITE’, 1); define(‘SUNRISE’, ‘on’); If … Read more
You can’t modify the parameters of a filter like that, that’s not what they’re there for. In the source code it’ll look something like this: $cookie = apply_filters( $cookie, $user_id, $expiration, $scheme, $token ); It’s explicitly looking for the value of $cookie. If you return the value for $expiration, things will break. The extra parameters … Read more
The post password cookie is set with: setcookie( ‘wp-postpass_’ . COOKIEHASH, $hasher->HashPassword( wp_unslash( $_POST[‘post_password’] ) ), $expire, COOKIEPATH, COOKIE_DOMAIN, $secure ); in the wp-login.php file. We can then use the clear_auth_cookie hook, in the wp_clear_auth_cookie() function, to clear it on logout: /** * Clear the Post Password Cookie on logout. * * @link http://wordpress.stackexchange.com/a/198890/26350 */ … Read more
You could use Javascript <script type=”text/javascript”> function getCookie(c_name) { var i,x,y,ARRcookies=document.cookie.split(“;”); for (i=0;i<ARRcookies.length;i++) { x=ARRcookies[i].substr(0,ARRcookies[i].indexOf(“=”)); y=ARRcookies[i].substr(ARRcookies[i].indexOf(“=”)+1); x=x.replace(/^\s+|\s+$/g,””); if (x==c_name) { return unescape(y); } } } var logged_in=getCookie(“wordpress_logged_in_[HASH]”); if (logged_in!=null && logged_in!=””) { alert(“You are logged in!”); } else { alert(“You are logged out!”); } </script> NOTE: WordPress logged in cookie info can be found here. … Read more
In my case it was a plugin which I installed yesterday night. In the next day I got this error. SOLUTION : Deleted the plugin from wp-content/plugins and every thing was OK after that.
This error is generated in wp-login.php , it happens if server is unable to set cookies, this can happen due to several reasons, one of the common issue is: output being sent before setting up of cookies. Try out following options: Update WordPress core, if it is not up to date change theme, if you … Read more
Try using secure method to prevent session hijacking Attack. Session Id should change/get refreshed evert time user get login and log out. WordPress doesn’t use PHP sessions, and doesn’t have a static session ID. You must be using a plugin or theme that is. login credentials should be encrypted at code level. WordPress’ login credentials … Read more