Get latest posts from multisite

There is actually a way to get posts from all multisite sub-sites. I do it with my “Multisite Media Display” plugin here https://wordpress.org/plugins/multisite-media-display/ .

I use it to display all media items from my multisite to ensure that any submissions meet the site requirements. Works great.

I have a similar plugin for posts, but it doesn’t work with the current WP version. Been a low priority to update it.

But you can get an array of all sub-sites (although the function that does that doesn’t work with WP versions prior to 4.6). Then you loop through that array, doing a post query as needed.

ADDED

Here’s some code, with comments. The code will get all subsites, then switch to each subsite, where you can put in your query and output the posts in ‘the loop’.

$subsites_object = get_sites(); // get the sites into an object
// convert to an array
$subsites = objectToArray($subsites_object);
// process each subsite
foreach ($subsites as $subsite) {
// get some values for later if needed
    // $subsite_id is important; that switches to the subsite
    $subsite_id     = $subsite["blog_id"];
    $subsite_name   = get_blog_details($subsite_id)->blogname;
    $subsite_path   = $subsite["path"];
    $subsite_domain = $subsite["domain"];
    switch_to_blog($subsite_id);
// do your post query, then do 'the loop' to get posts
}

You could put that into a template. Or you could add code for a shortcode that will output things.

Lots of help on the googles/bings/ducks. Look at the WP code docs to find out what each thing does.