The MU forums have moved to

hmmm, this seems odd (2 posts)

  1. zappoman
    Posted 15 years ago #

    So I was noticing that every time I changed a description of a category, the term_id was resetting... even though I wasn't changing the term, or the name (the term text)...

    I debugged it a little, and saw that in mu.php, there is this code:

    function sync_slugs( $term, $taxonomy, $args ) {
    	$args[ 'slug' ] = sanitize_title( $args[ 'name' ] );
    	return $args;
    add_filter( 'pre_update_term', 'sync_slugs', 10, 3 );

    Sure, this looks innocent enough, but it turns out that the "name" for some of my categories are identical, (they are children of other parents, which is allowed, unless you're George Forman, and then all your children have the same name)...

    But since this filter resets the slug, the normal processing for term updates says "wait a second, you can't have duplicate slugs" and so it comes up with a new slug name... and as a result a new term is added, and the term_id bounces around.

    This seems like a bug, certainly it's making my life difficult, and at the minimum it seems to be doing unnecessary work in the db.


  2. tdjcbe
    Posted 15 years ago #

    I'm torn. There was an issue way back when over on where updating the name of a category didn't always change the ID of the category. (The poster's category for the city that they lived in got renamed for a *cough* interesting sexual position. Lots of fun. And I believe she was running for political office at the time.)

    I;m wondering if this is related to that. I'd bring it up on trac.

    I can see it doing that if the category description is saved sitewide. If it's a local description, I can't see a change in the id number. I',m not in a position to check though,

About this Topic