• Does anyone know of a way in WordPress Multisite to retrieve an accurate list of the registered post types on a blog other than the one you’re currently viewing? When you use the switch_to_blog() function, the list of registered post types isn’t reset, so it still returns the registered post types for the blog you were initially working on, rather than returning the list of registered post types for the blog you switched to.

    I’m not sure if this is really even possible, since post types are registered for each individual blog at run time; but I wanted to check to see if anyone had any ideas (outside of initializing the other blog in a new window/frame and trying to return information through JSON(P)). Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Custom Post Types? How did you add them to the site? If it’s in the themes functions.php, I can’t see how you’d pull it in…

    You can declare custom post types in mu-plugins instead of the theme too.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Yeah, but then they’re network wide :/ Unless you do some serious pokery/jiggery with blog switching. Which is the only reason I use a plugin for ’em on one of my sites.

    Thread Starter Curtiss Grymala

    (@cgrymala)

    That’s kind of what I was afraid of.

    Basically, I’m working on a heavily modified version of the Sitewide Tags plugin, and I wanted to have the code automatically check to see if a post type is supported in the aggregate site before trying to create a copy of it.

    Right now, if I leave the code unchecked, I get an “Unknown Post Type” error when the plugin tries to create a copy on the aggregate site. The only reliable way I’ve found around it (other than to implement the option of manually indicating which post types should be syndicated) so far is to simply have the plugin ignore all posts that aren’t either a “post” or “page”.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Any way to retrieve accurate list of post types after switch_to_blog()?’ is closed to new replies.