WP_Query on different site in a multisite setup

Alternative option could be using the Rest API:

Example (post):

Search for Jane Doe in posts:

https://example.com/staffsite/wp-json/wp/v2/posts/?search=jane+doe

Example (custom post types):

If the public and searchable custom post type (e.g. staff) has show_in_rest set to true then we can search for Jane Doe in staff posts:

https://example.com/staffsite/wp-json/wp/v2/staff/?search=jane+doe

ps: Somewhat related, if you want to create your own route, using data from multiple sites in the network: WP REST API – Multisite – get posts from all sites

Leave a Comment