Changeset 8559
- Timestamp:
- 08/05/2008 10:05:53 PM (16 years ago)
- Location:
- branches/2.6
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.6/wp-admin/includes/schema.php
r8558 r8559 20 20 term_group bigint(10) NOT NULL default 0, 21 21 PRIMARY KEY (term_id), 22 UNIQUE KEY slug (slug) 22 UNIQUE KEY slug (slug), 23 KEY name (name) 23 24 ) $charset_collate; 24 25 CREATE TABLE $wpdb->term_taxonomy ( -
branches/2.6/wp-includes/query.php
r8505 r8559 1124 1124 $include_tags = "'" . implode("', '", $q['tag_slug__in']) . "'"; 1125 1125 $whichcat .= " AND $wpdb->terms.slug IN ($include_tags) "; 1126 $reqtag = is_term($q['tag_slug__in'][0], 'post_tag' );1126 $reqtag = get_term_by( 'slug', $q['tag_slug__in'][0], 'post_tag' ); 1127 1127 if ( !empty($reqtag) ) 1128 $q['tag_id'] = $reqtag ['term_id'];1128 $q['tag_id'] = $reqtag->term_id; 1129 1129 } 1130 1130 -
branches/2.6/wp-includes/taxonomy.php
r8394 r8559 762 762 global $wpdb; 763 763 764 $select = "SELECT term_id FROM $wpdb->terms as t WHERE "; 765 $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE "; 766 764 767 if ( is_int($term) ) { 765 768 if ( 0 == $term ) 766 769 return 0; 767 770 $where = 't.term_id = %d'; 768 } else { 769 if ( '' === $term = sanitize_title($term) ) 770 return 0; 771 $where = 't.slug = %s'; 772 } 773 774 if ( !empty($taxonomy) ) 775 return $wpdb->get_row( $wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); 776 777 return $wpdb->get_var( $wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $term) ); 771 if ( !empty($taxonomy) ) 772 return $wpdb->get_row( $wpdb->prepare( $tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy ), ARRAY_A ); 773 else 774 return $wpdb->get_var( $wpdb->prepare( $select . $where, $term ) ); 775 } 776 777 if ( '' === $slug = sanitize_title($term) ) 778 return 0; 779 780 $where = 't.slug = %s'; 781 $else_where = 't.name = %s'; 782 783 if ( !empty($taxonomy) ) { 784 if ( $result = $wpdb->get_row( $wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $slug, $taxonomy), ARRAY_A) ) 785 return $result; 786 787 return $wpdb->get_row( $wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $else_where AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); 788 } 789 790 if ( $result = $wpdb->get_var( $wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $slug) ) ) 791 return $result; 792 793 return $wpdb->get_var( $wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $else_where", $term) ); 778 794 } 779 795
Note: See TracChangeset
for help on using the changeset viewer.