[wp-trac] [WordPress Trac] #11361: Creating a term with the same name as a category, destroy the category.
WordPress Trac
wp-trac at lists.automattic.com
Tue Dec 8 14:53:54 UTC 2009
#11361: Creating a term with the same name as a category, destroy the category.
--------------------------+-------------------------------------------------
Reporter: giovans | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Unassigned
Component: General | Version: 2.8.5
Severity: normal | Keywords:
--------------------------+-------------------------------------------------
I create a blog, and a taxonomy of categories. [[BR]]
Let's say that one of them is Internet (with any slug you want, ie:
internet-89).[[BR]]
Then I add some posts over the blog, and some post is in the Internet
category.[[BR]]
So, now, I enter a new post, on any category, which contains the term
"Internet" as a tag. [[BR]]
When the tag is created, the category Internet is destroyed and replaced
by a number.[[BR]]
---[[BR]]
I have tracked down the problem over the code.
The thing happen on wp-includes/taxonomy.php in the wp_insert_term
procedure. Specifically on this line:[[BR]]
if ( ! $term_id = is_term($slug) ) {[[BR]]
At this point, $slug contains the sanitized name of the term.
is_term returns the id of the category (Internet, remember?), instead of
nothing, or by signalling an error. After this, the filter term_id_filter
is called and the global_terms procedure does the damage to the
category.[[BR]]
In my humble opinion. the is_term procedure, should be called as:
is_term($slug,$taxonomy) thus separating "category" and "post_tags".[[BR]]
Greetings and thanks for the support.[[BR]]
Giovans[[BR]]
--
Ticket URL: <http://core.trac.wordpress.org/ticket/11361>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list