[wp-trac] Re: [WordPress Trac] #5330: wxr import inserts tags with numbers instead of names

WordPress Trac wp-trac at lists.automattic.com
Fri Nov 9 03:48:00 GMT 2007


#5330: wxr import inserts tags with numbers instead of names
------------------------+---------------------------------------------------
 Reporter:  tellyworth  |        Owner:  anonymous
     Type:  defect      |       Status:  new      
 Priority:  normal      |    Milestone:  2.5      
Component:  General     |      Version:           
 Severity:  normal      |   Resolution:           
 Keywords:              |  
------------------------+---------------------------------------------------
Comment (by tellyworth):

 The problem starts around here:

 http://trac.wordpress.org/browser/trunk/wp-admin/import/wordpress.php#L390

 {{{
 390                         $tag_obj = get_term_by('slug', $slug,
 'post_tag');
 391                         $tag_id = 0;
 392                         if ( ! empty($tag_obj) )
 393                             $tag_id = $tag_obj->term_id;
 }}}

 $tag_obj->term_id is a numeric string, not an int.  It gets passed through
 as a string to wp_set_post_tags(), wp_set_object_terms() and is_term().
 is_term() sees that it's not an int, and assumes it's a tag name rather
 than an ID.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/5330#comment:2>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list