Simplest way to query with blog_id?

Written by  on November 3, 2016 

What is the simplest way to query posts using blog_id?

I have a post type called video that holds, not surprisingly, multiple embedded videos. Each post has a different video.

I would like to display a specific video in specific locations across different sites. The video posts are on Site 1, and other sites in the network could be Site 2, Site 3, Site 4 and Site 5. All sites are in the same multisite setup.

Each video is currently being identified by matching terms in two custom taxonomies, Taxonomy A and Taxonomy B.

If all posts were on the same blog I would use this to query the right video:

$video_query = new WP_Query( array(
    'post_type' => 'video',
    'post_status' => 'publish',
    'posts_per_page' => 1,
    'no_found_rows' => true,
    'tax_query' => array(
        'relation' => 'AND',
        array(
            'taxonomy' => 'TaxA',
            'field' => 'slug',
            'terms' => $the_termA
        ),
        array(
            'taxonomy' => 'TaxB',
            'field' => 'slug',
            'terms' => $the_termB
        ),
    )
) );

if( $video_query->have_posts() ) :
    while( $video_query->have_posts() ) :
    $video_query->the_post();

How can I make the query only look for posts in Site A?

Category : Wordpress

Tags :