You could use your list of blog ids in this way …
$posts = array();
foreach ( $your_list_of_blog_ids as $blog_id ) {
switch_to_blog( $blog_id );
$query = new WP_Query(
array(
'post_type' => 'any',
'posts_per_page' => 10,
)
);
while ( $query->have_posts() ) {
$query->next_post();
$posts[] = $query->post;
}
restore_current_blog();
}
Important are switch_to_blog and restore_current_blog. The rest of the code is just there to illustrate the idea.
Related Posts:
- How to get most recent commented post above new submitted post in WordPress?
- How to start with post number x?
- recent posts for different categories
- Displaying all posts from other sites on the network on one site
- Multisite how to display merged posts from two sites and sort by latest date?
- How to limit the number of posts that WP_Query gets?
- Get current post id in functions.php
- Random sort within an already sorted query
- WP_Query offset argument does not work
- Search by Hyphen
- Exclude drafts in all() view of edit.php
- Exclude posts that only have the ‘Uncategorized’ category [duplicate]
- post__in for get_posts with a dynamic array
- Keep getting same permalink with WP_Query?
- How to query posts with current or future date only
- Pagination not working on Custom Page Template
- Create new WordPress post [wp_insert_post] based on results of a WP_Query
- Strange switch_to_blog() issue
- How to add padding between posts
- Working Bootstrap Carousel Conversion to WP – Technical Questions
- How to hook a function only when I need to delete permanently a post?
- How to hide a post from ‘Recent Posts’ widget?
- Custom Order in WP Query
- Search query – exact post title match
- WP_Query posts_per_page ignored
- Two posts are loaded instead of one?
- wp_query ‘s’ parameter does not work with custom post type
- Automatic post deletion
- WP Query – duplicated posts once including tags in search results
- how to get posts ids inside pre_get_posts filter?
- I want to get title name of post, but i didn’t get by this code. Any suggestion?
- How can I show many posts an author has per week?
- How do I use WP_Query to get a range of posts with custom fields that have numbers with letters in them?
- How to exclude latest x posts from a paginated query?
- Setup a custom dynamic post
- Anyway to grab author name and featured image in an embeded in inital array of posts outside of loop?
- Removing noindex posts from wp_query
- Ajaxify This Code
- Multisite: Can’t Post or Create Categories
- Pausing and Resuming WP_Query results
- How to : pagination in 3 different custom loops on the same page
- WordPress Multisite – Create Default Post and New Category On New Site Install
- Exclude the first ‘n’ number of posts of a tag from home page?
- Set static page/post from another blog on same network
- wp_posts table: safely remove unused columns to save database storage
- Query Posts by Custom Field
- How to get date of post when using wp_get_recent_posts()?
- how can i change WP main archives loop to sort by name or title
- Using wp_list_pages() after calling query_posts()
- How to WP_Query() from multiple blogs and order them?
- Why are my paginated posts always returning the same results?
- Is it possible to filter the main loop to exclude posts from a specific category?
- Inner join overrides Advanced Custom Fields plugin’s get_field [closed]
- Loop doesn’t exclude the specified category in home page
- why the same code got different results when using query_posts in functions.php and index.php
- Query posts by Author and/or by Tag
- How do I show posts from another wordpress installation?
- How do I insert a after every 5 posts in a WordPress Loop that infinitely loads posts?
- WP_Query: Show 10 posts in date order, first three random
- Exclude some posts from displaying in wp_query based on some condition
- WordPress Loop: How to display recent posts in multiple divs
- Random posts that always include a particular post?
- Conflict array_splice on loop and query in widget
- Change Author Name to Sitename on Frontend
- Showing recent post of category in page
- WP_Query of Category Not Showing First Post
- Change content off every sixth element
- WordPress Query – Display 5 posts (same post type), each from a given tag
- While loop in functions.php outputting the_title() of each post on frontpage
- Show posts from two specific category in WP_Query
- How to create loop of posts except post ID defined via ACF field
- a WordPress connected to 2 database
- Using a meta_value or postdate to to query and orderby
- Exclude posts in home slider from sections
- WP_Query that targets all categories
- Fill the exclude array() in get_posts()
- Double loop output
- Ajaxify Post Sort
- Get current user, change users post status to published
- Displaying a specific sub-category’s posts from wp_query
- Custom layout manager for posts
- Display WordPress Post By Date
- GUID to related post not in current language
- Get results from the main wp_query
- How can I display a specific number of post in a category via a url
- How can I have the posts from one word press blog show on the presentation page of another word press site
- Advanced Post Display/Pagination/Ordering
- Sorting Posts by Date – get_blogs_of_user_id()
- Pagination for custom query won’t let me back on page 1
- Make assigning post to a specific category equivalent to assigning it to all categories
- WP_Query based on a custom field result
- How to get single post by one author?
- List posts related to category on a div [closed]
- WP_query sort by custom meta_key “price”
- Wp_query WooCommerce products
- posts_per_page – Repeats only first posts ‘post__in’ array
- query_posts different amount of posts per page [duplicate]
- Add custom PHP (no-SQL) filter to WP_query
- Get related posts matching most of the provided tags using WP_Query
- WP_Query post_tilte search in posts table