Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Query taxonomies in a multisite WordPress


Well, Hello

I have a wordpress multisite setup where posts are created in the parent site ( and will then be accessed and filtered by all the child websites setup ( , etc), I am using switch_to_blog to select gradvantage, but am struggling to get filtering working to show posts specific to the individual sites - the children sites just show all the posts!

taxonomy=sector (sectors are legal, banking etc)

the code below works fine on the parent gradvantage site, but when I run it on any of the children it shows me all posts - not filtered!

switch_to_blog(1); //magic!

$args = array(
'post_type' => 'companies',
'sector' => 'banking'
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post(); ?>
<h3><a href="<?php the_permalink(); ?>"><?php echo the_title() ?></a></h3>

<?php echo get_post_meta($post->ID, 'ecpt_overview', true); ?>




If its easier, I am happy to supply a login so you can play around

Answers (1)


Kailey Lampert answers:

Do your child-sites also have the 'sector' taxonomy?

npeplow comments:

Hi Kailey

No, the child sites have no posts of their own

Basically how I want it to eventually work is the child sites list posts specific to their category (law, business etc) and the parent site will list them all. All posts will be saved to the parents and managed from there

Kailey Lampert comments:

switch_to_blog() doesn't switch <em>everything</em> over the specified site - I learned this the hard way not long ago.

Try registering the custom taxonomy ('sector') on the child site and see if that helps.

npeplow comments:


thanks :)