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
- Unable to create categories and tags for posts in wordpress multisite
- Insert specific information to a posts of a predefined category
- Create a frontpage.php and static page template
- Making posts permalinks consistent numbers
- How to add a post class on every post. (on homepage)
- How to make posts being uncategorized
- Using Posts Like a Page
- Pagination for normal (standard) posts on a page with a custom loop?
- Hide content from Post Preview
- How to show category based post in home page?
- Problem with quotes
- How to get the next and previous image title from attachment or gallery?
- How to display a single(current) post from a category
- Changing wp_link_pages() to “Next Page” and “Previous Page” buttons?
- Delete post from admin but not from database
- Add Input Field in Simple Model Contact Form (smcf) plugin [closed]
- Why my meta boxes won’t show in front post page?
- Sidebar limiting to 10 posts?
- Authors’ Links on Homepage Not Going to Author Post Pages
- Attachment image single page
- Open a wordpress single post in a lightbox without the header and footer
- I can’t find the relevant part of the loop in my theme file. How do I find the full content with “More…”
- Get posts from current category?
- How to change the order of elements within a post?
- Only show featured image on exerpt and exclude images in post
- Short link to read complete post
- Send email to admin with post author
- how many visitor open this post? [closed]
- posts going to 2 pages/categories only show up in 1
- Approve modified posts
- Have posts included on a page that share same category
- displaying the categories post
- How to repeat a loop after 4 posts [duplicate]
- Shortcode for tables which can include comma and linebreaks
- How to show beneath posts the full category path?
- Preview page/post revisions without overwriting current content
- Delete all Tag Links from Posts
- Adding external field to my post form (admin side) and to post show (frontend side)
- Adjust the order for returned posts
- Export all posts to import as product items
- fetching posts and showing on frontpage
- How to add tag(s) to all posts from a specific category? [duplicate]
- Link from Post to Another Post Via Clicking on Words within Original Post
- WordPress as CMS: How to manage/handle images assigned to a post as full-sized background images in a slideshow?
- get last post’s link with SQL query
- Output Buffer Issue with Single Post View
- What’s a theme that properly handles previews of different types of posts?
- Custom Post Type Single Loop Outputting Wrong Post
- Display Parent Category of a Post belonging only to Subcategory
- show div only if have a related post inside
- Nest Next and Previous in a href with class that has a background image
- Using the loop to set locations for all posts on a single google map
- add_rewrite_rule and template redirect not working
- changing parent_id on post
- Change post date in menu to post title
- Change content off every sixth element
- adding my posts (author posts) in menu
- How to separate each individual blog post?
- sort posts by getPostViews in functions.php