Placester/builder — pull request #7 by jpacatte (2014-01-28 22:21:51+00:00)
Title: WP-269 Use slug to handle user-modified neighborhood (etc.) taxonomy terms

I added "api_field" and "api_term" to the term object returned by the plugin--when it is determined that the term corresponds to an MLS location in the api. The wordpress term for an MLS location can now be changed by a user without breaking the correspondence. Slug (or computed slug when the term object is generated automatically) is used as the primary key that maintains the relationship.

I looked at Gavin's code in the hearst branch using "disp_name" but I found the approach here preferable because it allows wordpress to use (edited to be pretty) normal term names in page titles, etc. through standard mechanisms. And because I've got existing users who already have modified term names in their databases. They're the ones who are complaining.

I'm not sure of the performance implications and could use some pointers as to evaluating them. Creating the slug lookup map and searching it is only done if the name itself doesn't match a known MLS location. (This makes things faster but ignores the case of a user changing a term name to be a different known MLS location other than the original. If they do that they're just asking for trouble though, right?) The caching code in the function doesn't appear to work in any case, so I'll probably look at fixing that.

These changes shouldn't break any existing behavior up the stack. But I'm not positive that everything relevant above gets funneled through this function. Are there other plugin functions I should look at?