When a site gets to a certain scale, storing categories on a per-blog basis starts to get a little messy. Assuming someone would want all WPMU blogs to share a single set of categories, how might one go about that? My gut it so store a set of “cannonical” categories in the root blog. Is there a more elegant or standardized solution?
Leave a Reply
You must be logged in to post a comment.
A more elegant solution would be to create a MU (must use) plug-in and drop it on the network. This plug-in would check (per-site) if the categories exist and, if not, add them as appropriate.
Here’s some untested example code:
This should loop through your list of categories and attempt to fetch the ID of each. If the category doesn’t exist,
get_cat_ID()
will return “0” so you know to insert the category. This code won’t set the slug, description, parent, etc … I leave that as an exercise for you to complete.Note: I’m assuming you want the categories to only be stored in one place…
If it was me and I had to do that I’d make an mu-plugin that hooks into the taxonomy insert/update/edit methods.
I’d create a new set of tables copied from the existing taxonomy tables for the parent site (just in case), with an additional field to indicate which site a post_id belongs to. The plugin would then be used to remap the name of the taxonomies table to our new site-wide one.
You’d then need a filter on all db queries to the taxonomical relationships to make them match the current site’s id.
You’d also need to remove people’s privileges to add/remove categories unless you’re a glutton for punishment.
In short (and IMO) it would be a lot messier and a lot more restrictive to your users to have a single set of categories shared between sites. You may as well have one site with multiple authors.
Not sure if this solves your question, but perhaps my plugin bbAggregate addresses your requirements? It allows you to create ‘streams’ of content from multiple blogs in a multisite WordPress install and aggregate them onto a page. It’s my replacement for Global Terms 😉
Have a look at the plugin:
http://wordpress.org/extend/plugins/bbaggregate/
Read this article about it:
http://www.roytanck.com/2010/09/30/bbaggregate-lets-you-mix-and-match-wordpress-content/
Feel free to contact me if you have any questions and/or remarks related
to this plugin,
Hi @editor:
Your question caused me to ponder many issues so I felt that the hackers list might be a good place to ask. Here’s the start of the thread; you might find it enlightening: