[wp-hackers] term_exists returns (string) based $term_id value as	opposed to (int).
    Haluk Karamete 
    halukkaramete at gmail.com
       
    Wed Oct 29 22:40:59 UTC 2014
    
    
  
I spotted this bug while I was migrating a legacy site into WordPress
In the wp_insert_term function, there is a section that goes like this;
    if ( $term_id = term_exists($slug) ) {
        // if you are here, then you got a string based $term_id in your
hands.
        // example: (string
    } else {
        //do stuff here
        $term_id = (int) $wpdb->insert_id;
        // here, there are no problems here... cause $term_id is forced to
be an integer!
    } endif;
    Having a string term_id causes a problem later on down the road,
    When the wp_set_post_terms() is called with its $tags argument having
string formatted term_ids, those terms are considered as no-show under the
corresponding taxonomy, and wordpress creates new terms on the fly.
    
    
More information about the wp-hackers
mailing list