[*]
get_sites()
will get a list of the sites in a Multisite network. You can then use switch_to_blog()
[*], get_posts()
/ get_pages()
, and restore_current_blog()
[*] to get the pages from the various sites.
I’d strongly recommend storing the results as a sitewide option using update_site_option()
to lessen the load on your server. You could add a job to wp_cron()
to update your option periodically, or add an action to the save_post
(or one or more appropriate Post Status Transition hook(s), such as new_to_publish
and draft_to_publish
) to update your stored menu list. An added advantage to keeping the menu list in a site option is that you can access it from any site in your network using get_site_option()
.
[*] — When Multisite originally came out, the terminology was a site of blogs; later it changed to a network of sites, but the old ways still appear in function names like switch_to_blog()
and restore_current_blog()
.
[*]