Make WordPress Core


Ignore:
Timestamp:
08/24/2007 02:44:26 PM (19 years ago)
Author:
ryan
Message:

Update WP importer to use taxonomy and query cat based on slug. see #4613

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/taxonomy.php

    r5906 r5937  
    283283 *      might be inaccurate or wrong.
    284284 */
    285 function get_term_by($field, $value, $taxonomy, $output = OBJECT) {
     285function get_term_by($field, $value, $taxonomy, $output = OBJECT, $filter = 'raw') {
    286286        global $wpdb;
    287287
    … …  
    307307
    308308        wp_cache_add($term->term_id, $term, $taxonomy);
     309
     310        $term = sanitize_term($term, $taxonomy, $filter);
    309311
    310312        if ( $output == OBJECT ) {
    … …  
    488490        else if ( 'ids' == $fields )
    489491                $select_this = 't.term_id';
     492        else if ( 'names' == $fields )
     493                $select_this == 't.name';
    490494
    491495        $query = "SELECT $select_this FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ($in_taxonomies) $where ORDER BY $orderby $order $number";
    … …  
    772776        if ( empty($slug) )
    773777                $slug = sanitize_title($name);
    774         else
    775                 $slug = sanitize_title($slug);
    776778
    777779        $term_group = 0;       
Note: See TracChangeset for help on using the changeset viewer.