switch_to_blog
does not support switching to multiple blogs at the same time, instead if you want to list all posts in a network, you’ll need to loop through each blog, using switch_to_blog
and restore_current_blog
, saving each post in each site into a PHP array, then finally displaying every post in that array once it contains all the posts.
Note that this will require you to understand PHP variables, arrays, and WP_Query
, the first two of which you can find in any basic PHP tutorial, and the last you can find a good set of slides by Nacin You don’t know Query