wp query – Apply a custom WP_Query to the whole multisite network

Question

I want to fetch all posts given a certain meta_key and meta_value restriction.

That can be done as follows:

$args = array(
    'meta_query'        => array(
        array(
            'key'       => 'langpack_identifier',
            'value'     => 'whatever'
        )
    ),
    'post_type'         => 'post',
    'posts_per_page'    => '10'
);

And then using get_posts() or directly creating a new instance of WP_Query. But this will only fetch posts within the current site.

How can I extend the query so that it includes all results for all the sites in the network?

0
Alvaro Franz 5 months 2021-07-13T03:48:25-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse