Getting data from another blog on the same multisite install can be done. Some people use SQL commands to do this, but this can be slow, and error prone.
Although it's an inherently expensive operation, you can make use of
restore_current_blogto make it easier, while using the standard WordPress APIs.
switch_to_blog( $blog_id );
// Do something
restore_current_blogundos the last call to
switch_to_blog, but only by one step, the calls are not nestable, so always call
Keep in mind though, that this changes the data, it does not reload the plugins and theme to match the blog when switching.
Listing blogs in a network is possible, but it's an expensive thing to do.
It can be done using the
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.
Domain mapping allows a blog on a multisite install to serve from any domain name. This way a blog does not have to be a subdirectory of the main install, or a subdomain. The WordPress Default supports Domain Mapping without Alias. Add the Domain in the blog-settings to the blog of the Network administration area.
Often is it helpful - but not necessary, to set the
COOKIE_DOMAINconstant to an empty string in your
define( 'COOKIE_DOMAIN', '' );
Otherwise WordPress will always set it to your network’s
$current_site->domain, which could cause issues in some situations.
WordPress Core hopes to provide Domain Alias Mapping in the future, but until then you can make use of one of the following plugins: