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
- simply loop through posts
- Difference between an archive and a page listing posts
- WordPress Queue like Tumblr?
- Moving WordPress to new server: no posts found
- the_post_navigation seems to ignore same category filter
- How to avoid duplicate posts on front page?
- Get current users post URL?
- Remove some articles from the list in WPAdmin for a user
- Pagination – Posting First Page Content
- How to show featured image in custom post type dashboard post page
- Notification to Admin or Author upon new post [duplicate]
- Is there a way to apply WordPress categories at the block level?
- SQL query to retrieve all the records that have not indicated category
- Preserve term order per post in a non-hierarchical taxonomy
- How should I add links to other pages/posts from my post?
- Unautop / Sanitize content added to a post through a plugin
- WordPress programatically inserted post not showing in authors profile
- WP Remote Request not returning all of content via request
- Update all comments time to random dates?
- How can I get global $post to work for CPT and update user?
- How to copy posts from one site to another in real time (not multisite)
- Show only one page link in content pagination
- Include sticky posts on the static page front page
- How can I setup a relationship using categories in WordPress?
- Automatically Import WordPress Blog to Facebook Page [closed]
- Editing 375 posts simultaneously? Maybe from the database?
- How Do I Get My Post Tags to Alphabetize?
- How to add a class to edit_post_link?
- Transition from Draft to Scheduled Post with wp_update_post
- Posts showing […] in it
- Custom Permalink Structure for Pages & Posts
- Getting a “404 Not Found” error when “Preview Changes” is clicked
- How to give classname to post if post has no content?
- Split post title for styling
- Audio post format with Advanced Custom Fields
- Post/page title to permalink transformation – what is behind the scenes?
- How to show full post on home page
- Trying to exclude custom posts based on date, while sorting by custom field
- Show Last Revision Of Post That Has A Published Status On Single Page
- How to work with posts and sub posts?
- Javascript – How do I get specific post fields?
- Taxonomy checkboxes not showing current status on edit page
- Add a url parameter to the current post and read it in a shortcode
- getting custom post by tag
- Retrieve posts inside foundation tabs and tab-content split by 3 per row
- Make recent post display recent updated, instead of recent published
- Custom post type – Loop out in random order but same 15 to appear first… still random
- Change the URL of posts by category
- Blog only showing one post even though more published
- Show only top 3 posts from 3 categories in order on home page
- Help with a function that will place a map pin for all posts
- Order posts by separate menu order for different sub-categories
- Modifying the permalink href for posts with jquery
- The loop: more posts than I want to fit on one page
- How do I link to the posts page?
- How to find the page of specific post?
- Count words for all posts by all authors
- Optimize blog that serves hundred of images and videos
- Add text/link next to the last word of each post