Skip to content

Query only 1 website #24

Description

@sebastienserre

Hello

I'm trying to use this tool so query a CPT in a network with the followong code:

` $args = array(
'post_type' => 'petite-annonces',
'sites' => array(
'sites__in' => array( 1,2 ),
)
);

$query = new WP_Query_Multisite( $args );

while( $query->have_posts() ) : $query->the_post();
    $blog_id = get_current_blog_id();
    echo $blog_id . get_the_title() . "<br>";
endwhile;

wp_reset_postdata();`

I get post from sites 1 but not the site with id 2...

Any idea to help me me?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions