Ticket #17646: 17646.diff
File 17646.diff, 3.1 KB (added by , 13 years ago) |
---|
-
wp-includes/taxonomy.php
354 354 unset( $args['capabilities'] ); 355 355 356 356 $args['name'] = $taxonomy; 357 $args['object_type'] = array_unique( (array) $object_type );357 $args['object_type'] = array_unique( (array) $object_type ); 358 358 359 359 $args['labels'] = get_taxonomy_labels( (object) $args ); 360 360 $args['label'] = $args['labels']->name; … … 1502 1502 */ 1503 1503 function sanitize_term($term, $taxonomy, $context = 'display') { 1504 1504 1505 if ( 'raw' == $context )1506 return $term;1505 //if ( 'raw' == $context ) //sanitize_term_field returns when raw after int'ing appropriate fields. 1506 // return $term; 1507 1507 1508 $fields = array('term_id', 'name', 'description', 'slug', 'count', 'parent', 'term_group' );1508 $fields = array('term_id', 'name', 'description', 'slug', 'count', 'parent', 'term_group', 'term_taxonomy_id'); 1509 1509 1510 1510 $do_object = false; 1511 1511 if ( is_object($term) ) … … 1558 1558 * @return mixed sanitized field 1559 1559 */ 1560 1560 function sanitize_term_field($field, $value, $term_id, $taxonomy, $context) { 1561 if ( 'parent' == $field || 'term_id' == $field || 'count' == $field || 'term_group' == $field ) {1561 if ( 'parent' == $field || 'term_id' == $field || 'count' == $field || 'term_group' == $field || 'term_taxonomy_id' == $field ) { 1562 1562 $value = (int) $value; 1563 1563 if ( $value < 0 ) 1564 1564 $value = 0; … … 1886 1886 $query = "SELECT $select_this FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN $wpdb->term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND tr.object_id IN ($object_ids) $orderby $order"; 1887 1887 1888 1888 if ( 'all' == $fields || 'all_with_object_id' == $fields ) { 1889 $terms = array_merge($terms, $wpdb->get_results($query)); 1889 $_terms = $wpdb->get_results($query); 1890 foreach ( $_terms as &$term ) 1891 $term = sanitize_term($term, $taxonoy, 'raw'); 1892 $terms = array_merge($terms, $_terms); 1890 1893 update_term_cache($terms); 1891 1894 } else if ( 'ids' == $fields || 'names' == $fields ) { 1892 $terms = array_merge($terms, $wpdb->get_col($query)); 1895 $_terms = $wpdb->get_col($query); 1896 $_field = ('ids' == $fields) ? 'term_id' : 'name'; 1897 foreach ( $_terms as &$term ) 1898 $term = sanitize_term_field( $_field, $term, $term, $taxonomy, 'raw'); 1899 $terms = array_merge($terms, $_terms); 1893 1900 } else if ( 'tt_ids' == $fields ) { 1894 1901 $terms = $wpdb->get_col("SELECT tr.term_taxonomy_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tr.object_id IN ($object_ids) AND tt.taxonomy IN ($taxonomies) $orderby $order"); 1902 foreach ( $terms as &$tt_id ) 1903 $tt_id = sanitize_term_field( 'term_taxonomy_id', $tt_id, 0, $taxonomy, 'raw'); // 0 should be the term id, however is not needed when using raw context. 1895 1904 } 1896 1905 1897 1906 if ( ! $terms ) … … 2901 2910 } 2902 2911 $termlink = home_url( user_trailingslashit($termlink, 'category') ); 2903 2912 } 2913 2904 2914 // Back Compat filters. 2905 2915 if ( 'post_tag' == $taxonomy ) 2906 2916 $termlink = apply_filters( 'tag_link', $termlink, $term->term_id );