wordpress multisite logout of all network sites simultaneously

i have a wordpress network (multisite) setup that i would like help coming up with a solution for a problem that seems to be core to the nature of wordpress multisite.

problem:
when i log into the main network site (mysite.com/member/) access to all of the other network sites is automatically authenticated and gratned.

Read More

the issue is when logging out of one of the network sites, the wp_logout() function only seems to affect the existing site being viewed.

for example: logging out of mysite.com/network-site/ it in fact does log out, however navigating back to mysite.com/member/ shows the user as still logged in and authenticated with full access.

question:
what can i do to program the wp_logout() function so that all sites in the network have the authentication cookie trashed/removed thus actually logging the user out of all network sites?

thank you for your help!
andrew

Related posts

Leave a Reply

1 comment

  1. problem: when i log into the main network site (mysite.com/member/) access to all of the
    other network sites is automatically authenticated and gratned.

    Just remove the user you are using for the parent site from all the other sites.

    You can define how wordpress handles the authentication cookie in your main wp-config.php. What we need to do here, is to force WordPress to follow the correct cookie path. This can be done by adding this to your wp-config.php file located in your WordPress installation root directory:

    define('ADMIN_COOKIE_PATH', '/');
    define('COOKIE_DOMAIN', '');
    define('COOKIEPATH', '');
    define('SITECOOKIEPATH', '');