try this
$sites = get_sites();
global $switched;
/** @var WP_Site $site */
foreach ($sites as $site) {
if ( $site->archived || $site->spam || $site->deleted ) {
continue;
}
switch_to_blog( $site->blog_id );
$all_posts = get_posts('category=-3&numberposts=6&orderby=post_name&order=DSC');
?>
<ul>
<?php foreach($all_posts as $post) : setup_postdata($post);?>
<li>
<a href="https://wordpress.stackexchange.com/questions/354427/<?php echo get_page_link($post->ID); ?>" title="<?php echo
$post->post_title; ?>"><?php echo $post->post_title; ?></a>
</li>
<?php endforeach ; ?>
</ul>
<?php
}
restore_current_blog();
die;
Related Posts:
- Strange switch_to_blog() issue
- How to Display Network Post Count?
- How to cache a shortcode functions output?
- Querying post from a multisite network
- How to get a post content from another wordpress blog/site?
- how to enable different number of revisions for different blogs when using WPMU?
- How to hook a function only when I need to delete permanently a post?
- How to share same post to multiple site in wordpress?
- How to create post in WP network using WP-CLI
- Pull posts from another wordpress install on same server
- Query posts from different categories in multisite
- How to show last post of each website of a MU wordpress in HomePage
- How to display content from the main blog on another from multisite network as it would be its own
- Multisite: Can’t Post or Create Categories
- Unable to restore from backup – how to obtain old blog posts?
- Pagination with an array of post objects?
- WordPress Multisite – Create Default Post and New Category On New Site Install
- Set static page/post from another blog on same network
- How to WP_Query() from multiple blogs and order them?
- Is it possible to filter the main loop to exclude posts from a specific category?
- How do I show posts from another wordpress installation?
- Display password protected posts to logged in users
- Change Author Name to Sitename on Frontend
- Cannot select certain authors for posts after import
- why the posts queried from sql is more than those showed on the page?
- Prevent duplicate pages from being added
- unable to write to the database while uploading images
- 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?
- Multisite Issue on Subdomain’s article pages
- Populate a drop down list with post titles across a multisite network
- How can I have the posts from one word press blog show on the presentation page of another word press site
- How to get posts from network blog
- Sorting Posts by Date – get_blogs_of_user_id()
- Users cannot post when editor or admin on more than 1 site on multisite
- How to link two news page multilingual press
- Get image paths from RSS feeds
- making a few sites in wordpress
- Do I need to create a multisite for querying posts from multiple WordPress sites?
- Site ‘Categories’: save an admin global setting with post metadata [closed]
- users followin the blog post author
- Is it possible to Schedule Attachments in WordPress?
- Allow variable amount of comments before pagination
- Is post ID number always incremental n+
- Check if post has children or not
- Create custom page in WooCommerce
- Duplicate posts
- HTML code in Custom field
- why when I try to insert an image attachment along with a post does wp_get_attachment_url give me a very wrong file path?
- post_parent is 0 when uploading new files
- Redirection to taxonomy posts list after post submit.
- Frontend Post Excerpt field mapping
- Divide Loop Into Days & Categories
- WordPress – Hide posts in admin from user who did not write them
- Multi-site: removing /blog from posts
- How to display different number of posts
- What part of template to edit to remove category name from the top of posts?
- Register post status, exclude from searches
- Format the Layout of Images In The Edit Post Textarea?
- Choose whether to automatically add a taxonomy with the same name as the post
- Which WordPress hook fires after post content loaded?
- Enable Comments Box On Custom Post Type
- Integrate OpenStreetMap on WordPress
- Prevent additional top level categories but allow more children
- how do i add posts-page slug before posts slug in permalinks
- Admin – create custom post status and display above table
- the_permalink() not working in a root installation
- Hide posts belongs to few categories in homepage
- Get post ID from a link
- Run query_posts if SESSION is empty?
- Relative number of post in category
- Is it possible to automatically publish a post once a woo-commerce product is published?
- Post is blank when I click on the link
- Update all posts in a loop everyday
- Change url-structure for wordpress pages – pages in strucutre not top-level
- Get postlist for each category using query_posts?
- How to save posts position on homepage after random function?
- Post Templates and Post ID’s
- How to embed custom HTML code with no plugins?
- Display in category ( taxonomy) a number of post that I want
- Help on conditional statement to accompany wp_insert_post function please?
- Delete media from the post but keep my featured image and post
- Every time I try accessing a post it redirects me to the feed
- Loop and output 4 rows of posts on home page
- Bulk Post update_post_meta
- More Than 50K Categories and WordPress Admin Panel Stop Showing Categories and Posts
- Hiding the name of the user who is currently editing
- Random order of the 5 most popular posts
- List posts of assigned categories in list of all categories on single.php
- Display result of custom form
- How can I choose and change a post title at random from an array when it is published?
- How to show the posts list into a static page? Problems to use the loop into a static page
- Displaying Results From Custom Taxonomy Query
- find posts with exactly 3/4 categories
- new blog post does not appear in blog after publishing
- wordpress taxonomy results
- wp trim function not working
- Custom post page has attributes of latest post [closed]
- How to make “my posts” page
- I cannot see the pagination in /wp-admin posts page