[wp-hackers] WordPress MU Category Slugs

Brian Layman Brian at TheCodeCave.com
Fri Dec 11 21:39:00 UTC 2009

There is code in WPMU that is there to further some non-standard WP features
(re: the whole site-category table). When importing all of the b5media sites
into MU, I had to disable all these because there were has some fundamental
flaws in the logic that we ran into very quickly due to the imports.  Mark
Jaquith and I spent hours going over the code and disabling it was the ideal
solution. I've not looked at it much since, so some core logic may have
change in the most recent version. I saw Donncha refer in that conversation
to tags, but when I was looking at it it very specifically only dealt with
categories and that was the problem.

In short, there is an attempt to give all categories the same IDs across the
board. In order for a category name to have the same meaning on one blog as
another, and the links match that meaning, the category name and category
slug had to be related. Normal WP sites don't have this restriction. So when
importing from a normal wp blog, the matching of slug and category can cause
problems.  e.g. If you ever edit a category and have the slug changed
without your consent, you will very quickly find your Google 404 listing
cranking up as your permalinks change even though you'd only made a change
to the category name or description.  

Additionally, because tags and cats both work off of term IDs and only
category ids were syncronized between blogs and because that syncronization
is based upon an autoinc field in the site_categories table, there are
problems. Collisions of the new syncronized category IDs and the more
rapidly increasing max termID on the individual blog (due to extensive tag
usage), are increasingly likely over time.  Once an individual blogs autoinc
termID is greater than the siteCategory's autoinc ID, you get key violations
that aren't handled well by the editor displayed only as "Cannot edit"
messages upon category edit.

To solve all of this, I disable both of these mu customizations with a
plugin that has these lines:
remove_filter ( 'term_id_filter', 'global_terms', 10, 2 );
remove_filter( 'get_term', 'sync_category_tag_slugs', 10, 2 );

YMMV et al

- brian layman

-----Original Message-----
From: wp-hackers-bounces at lists.automattic.com
[mailto:wp-hackers-bounces at lists.automattic.com] On Behalf Of Tim
Sent: Monday, December 07, 2009 3:15 PM
To: wp-hackers at lists.automattic.com
Subject: [wp-hackers] WordPress MU Category Slugs

Just out of curiosity - was/is there a reason why WordPress MU doesn't allow
category slugs to be edited. I've looked through this conversation -
http://mu.wordpress.org/forums/topic/12258 - but I'm interested in any
additional thoughts.

wp-hackers mailing list
wp-hackers at lists.automattic.com

More information about the wp-hackers mailing list