I created a plugin which does something similar (called Multisite Post Display https://wordpress.org/plugins/multisite-post-reader/ ) . It displays posts from all multisite sub-sites.
The code in there might be helpful for what you are doing. You are welcome to dig into it and use the code to help with your project. (After all, I used other people’s code snippets to develop it.)
I wrote it after I did the Multisite Media Display, since I wanted a way to display media from subsites on one page, and couldn’t find any plugin that did that. Both have been useful to monitor posted media and content from my multisite.
Free, open source, and all that. Hope it is helpful.
Related Posts:
- Get Recent Posts by Date in Multisite
- How to get post from all Blog Multisite to the Main Site?
- When should you use WP_Query vs query_posts() vs get_posts()?
- When to use WP_query(), query_posts() and pre_get_posts
- WP_Query vs get_posts
- Using get_posts vs. WP_Query
- Delete all posts from WordPress except latest X posts
- Sanitation needed for WP_Query or get_posts calls?
- Differences Between WP_Query() and get_posts() for Querying Posts?
- get_posts with multiple categories
- Use of caller_ get_ posts
- How-to exclude terms from the main query the most performant way?
- Merging multiple wp_query objects
- Query all posts where meta value is empty
- get_posts not finding argument: post_name
- Meta Query with date and time on the same Day before given time
- Get posts with condition on comment meta value
- Use post__in and post__not_in together?
- WP_Query on different site in a multisite setup
- What should I use, get_posts or wp_query for less CPU load?
- Different Results with query(‘s=computer’) vs get_posts(‘s=computer’)?
- Get all posts without tags
- get_posts() seemingly ignoring post_type
- Can not switch the queried post in pre_get_posts hook
- Get posts from the Main site to sub site – WordPress MultiSites Network
- How to find out what “Blog pages show at most” is set to [duplicate]
- Count posts returned by get_posts in external PHP script
- How can i get the last post from wp multisite?
- WP_query category__in not working, only pulls from first category
- SELECT * FROM $wpdb->posts WHERE ID > 160
- Adding multiple post queries with parent and children to page – Best Way
- How do you Query posts with nothing in common?
- WP_Query, tax_query and term_meta: How to?
- get_posts – get all posts by array of author
- Creating a custom search for a specific post type
- get_posts() not working with multiple statuses
- Return only post(s) which have post_excerpt
- Database Queries Optimization with new WP_Query
- Help with WP_Query – Too many mySQL queries
- WP_Query() and get_posts() can’t handle over a thousand posts?
- Need Help For WPQuery
- Multisite – Global CPT – advices?
- Multisite wp_query & switch_to_blog issue
- the_post() within switch_to_blog() altering my excerpt
- WP_Query post_parent parameter always returns children of current page
- get_post_meta slowing down my page load (in a plugin)
- How to show more post at a given category?
- How to count posts with specific arguments
- Check return value of get_posts
- Get all posts which was posted on X Days WordPress
- Query post with meta value in set of values
- get_posts output always same post
- get_posts always returning the same number of posts = 5
- get_posts() and global variables
- complex get_posts() query to select child pages
- get_posts custom field
- Using get_posts to get posts based on a checkbox value with Advanced Custom Fields
- How to apply a function to a metadata value before launch a WP Query?
- Posts query according to meta box date
- Woocommerce: order posts by meta key
- How to get posts by category and by choosing a taxonomy term?
- How to access $wp_query object from array of posts given by get_posts?
- Function using get_posts() with tax_query not working when called from functions.php
- get_posts query matches too many results
- Search for pages with permalink
- How to query for a page, get data, then query for child pages of that page
- Execute PHP function inside the admin area
- Magazine style frontpage with multiple categories/loops and no duplicate posts
- Prioritising and Ordering Posts By Category Name Using A Custom Loop
- Why my query is not “Main_query”?
- Facing problem with tax_query results
- get_posts query is taking about 40 seconds to execute
- Populate select list with meta values from all posts of a Custom Post Type
- Form checkbox value going to dynamic URL
- get_posts return only first result
- Related posts queries
- How to get meta key list efficiently?
- how to get wp_query posts only first letter of alphabet A?
- In a WordPress multisite configuration, how do I instruct WP_Query() to return posts from a sub-site?
- Different query result on local and server
- I cannot get tax_query in get_posts() to work with custom taxonomy
- Getting the last X posts, but in ascending order of time
- how to avoid reloading/refresh the page when displaying the post of wp_list_categories
- Problem with infinite scroll on multisite with custom query
- Ordering Posts by parent category, name ascending
- Use not custom fields in get_posts() meta_query?
- Mathematical operations on custom field values? (updated)
- When should you use WP_Query vs query_posts() vs get_posts()?
- get_posts works but new wp_query doesn’t
- Why WP_Query in functions.php is not working when get_posts works?
- Retrieve posts in custom post type and specific taxonomies
- Query specific number of posts for each post type in specific order
- get_posts shows current post, not defined posts with args
- Query custom post types by meta field in a term from custom taxonomy
- How to replecate the _fields parameter in custom REST api endpoint
- WordPress extremely slow when using get_posts with multiple meta_query relations
- Empty query on Custom Post Type, using WP_Query or get_posts
- A Depth Like Parameter For “get_posts”
- Sort by multiple columns using get_posts
- How to cache wordpress get_posts query using transients?