WordCamp 2019 - Building Multisite Taxonomy Plugin
July 20, 2019•358 words
David Marshall
Harvard TH Chan School of Public Health
- Harvard uses WordPress with lots of development, large-scale (2000 sites)
- reinforces that we aren't crazy or janky, lots of people use it as a platform to grow on
Terminology
- taxonomy: system of classification, most commonly used for posts group into categories and tags. can create custom taxonomies
- tags: predefined WP taxonomy, generally used for post, non hierarchical focus on topic
- category: the other predefined, can be hierarchical and generally broad class to cover wide focus
- terms: refers to items in taxonomy
- WP multisite: multiple website from one WP install -- this might be a better way to go
- HV WP is one install running thousands of sites
- all taxonomies and content stay within particular site, so wouldn't be great for us (hence the plugin they developed)
goal of this plugin was to create taxonomies that could be shared across sites
they researched it:
- deprecated plugin
- stack exchange
- plugin that synced across sites but doesn't work for large number
- plugin that creates shadow copies
Solution
- multi-site tagging engine that allows for cross-tagging of categories and tags
- presentation layer for related tags and taxonomies
- plugin is at https://hsph.me/multitaxo !! Github link
- extended core code from WP
- added network db tables/admin screens
- built front-end UI for multisite tagging also
- added WPMultisiteQuery to complement/augement WP_Query (beta-ish)
- added registermultisitetaxonomy (complimenting register_taxonomy)
- from there pretty much the normal way to go
- same sort of front end look in box labeled Multisite Tags that shows the taxonomies created for that install
- they built for extension, they have used it to do related content concepts
- to do query across blogs they use raw SQL instead of "switch between blogs"
- using object cache (Redis) on their own site, added cache into plugin itself a little too
Next steps
- continuing to migrate front end elements out of theme and into true plugin
- bringing it into WP repository
- permissions to keep people from adding tags