[wp-trac] [WordPress Trac] #20541: taxonomy_exists doesn't work within switch_to_blog

WordPress Trac wp-trac at lists.automattic.com
Wed Apr 25 11:02:47 UTC 2012


#20541: taxonomy_exists doesn't work within switch_to_blog
--------------------------+------------------------------
 Reporter:  mooontes      |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Taxonomy      |     Version:  3.3.1
 Severity:  normal        |  Resolution:
 Keywords:                |
--------------------------+------------------------------

Comment (by dd32):

 > The problem is that "taxonomy_exists" relies on "$wp_taxomies" array
 that is not repopulated when using "switch_to_blog".

 switch_to_blog() simply switches to using that blogs database tables and
 details, it doesn't load the plugins that are activated for that site (nor
 can it), so any taxonomies registered by plugins on those site won't be
 available on the current blog.

 > I guess being able to use switch_to_blog() would be one benefit of
 storing post type and taxonomy definitions in the database.

 But not having the plugin code responsible for those post types/taxonomies
 loaded in the current request, works against that advantage

 As a result, I don't think there's anything we can actually do here and
 provide a reliable environment.. Storing it in the database is ok for an
 incredibly simple taxonomy, but for those, perhaps it should be registered
 for all the sites instead.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20541#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list