| 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) ); |
|---|