switch_to_blog
and restore_current_blog
to make it easier, while using the standard WordPress APIs.restore_current_blog
undos the last call to switch_to_blog
, but only by one step, the calls are not nestable, so always call restore_current_blog
before calling switch_to_blog
again.get_sites( $args)
function, available since version 4.6 of WordPress. The get_sites( $args)
function accepts an array or query string of site query parameters specifying the kind of sites you are looking for. For versions 3.7 to 4.6 a similar function wp_get_sites( $args )
was available.COOKIE_DOMAIN
constant to an empty string in your wp-config.php
:$current_site->domain
, which could cause issues in some situations.