Skip to content

Instantly share code, notes, and snippets.

@spacedmonkey
Created November 8, 2017 09:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spacedmonkey/11405ce22c3ccbea0683fefcc7f1a21b to your computer and use it in GitHub Desktop.
Save spacedmonkey/11405ce22c3ccbea0683fefcc7f1a21b to your computer and use it in GitHub Desktop.
<?php
/**
* Force cookie constants to be local domain / path
* after multisite is loaded.
*/
add_action(
'ms_loaded', function () {
$site = get_site();
define( 'COOKIE_DOMAIN', $site->domain );
define( 'COOKIE_PATH', $site->path );
define( 'SITECOOKIEPATH', $site->path );
define( 'COOKIEHASH', md5( $site->domain . $site->path ) );
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment