Multisite – get thumbnail for merged get_posts() queries

I have a multisite Installation and have merged get_posts() queries to get it ordered by date. The Problem is now, to get the thumbnail of each post because the $post has no ‘blog_id’ Information.

Is there a way to search by guid over the whole database? Or could i extend the queries with the blog id or thumbnail that i can use it in the foreach?

Here is the function to get the Posts:

function get_multisite_posts( $args = 'posts_per_page=5') {

    $custom_posts = array();
    $blog_ids = wp_get_sites();
    foreach ($blog_ids as $key=>$current_blog) {
        $custom_posts = array_merge($custom_posts, get_posts($args));

    $custom_posts = wp_list_sort( 

        return $custom_posts;

And here then I do the foreach:

foreach($custom_posts as $post) : setup_postdata($post);

If the post is from the current blogID, then I get the thumbnails. If the post is from another blogID, I get – of Course – nothing.

Anyone has an idea?

Thank you very much in advance.

Read more here: Multisite – get thumbnail for merged get_posts() queries

Leave a Reply

Your email address will not be published. Required fields are marked *