[wp-hackers] Accessing custom post types and taxonomies across sites on a network

Philip M. Hofer (Frumph) philip at frumph.net
Mon Jan 24 22:21:34 UTC 2011

I would use a custom sql query on wp_1_posts to search for the post_type in 
question, and/or taxonomy table that directly queries the wp_# blog that has 
all the info on it, instead of trying to reinvent any unnecessary overhead

You can do that in your with your shortcode code, wouldn't need to 
switch_blogs since all the data is in the database anyways, would need to 
write your own sql query lines though that hits the table for the blog that 
has all the info in it though but thats it.

It also means that the editing of the information sticks with whatever blog 
has the custom post types in it and any url redirects need to hit the blog 
as well that has it defined.

But, totally doable.

----- Original Message ----- 
From: "Bill Dennen" <dennen at gmail.com>
To: <wp-hackers at lists.automattic.com>
Sent: Monday, January 24, 2011 1:48 PM
Subject: Re: [wp-hackers] Accessing custom post types and taxonomies across 
sites on a network

>> Where is the taxonomy being registered? In the theme?
> Thanks, yes, in this case it's being registered in the theme that the
> profiles site is using. It's not registered elsewhere.
> My ultimate goal is to create a shortcode. Something like:
> [department_roster dept="Economics"]
> This would produce an unordered list of faculty in the Economics 
> department.
> There may be other options too, like:
> [department_roster dept="Economics" show_photos="true"
> show_titles="true" show_degrees="true"]
> In this case, the list of faculty would also include their photos,
> titles and degrees.
> Back to your question, I suppose I could just define the taxonomy in
> mu-plugins. But, then it would be defined in a lot of sites that would
> not need it. Too much overhead?
> I know people do not seem to like switch_to_blog in general. But, it
> seems like it's made for this sort of thing - where WordPress is
> basically an enterprise-wide CMS. While using JSON would work, it
> seems to be an odd approach, since everything is already in WordPress
> to begin with.
> -Bill
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

More information about the wp-hackers mailing list