Changeset 45590 for trunk/src/wp-includes/taxonomy.php
- Timestamp:
- 07/02/2019 11:41:16 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/taxonomy.php
r45362 r45590 1404 1404 $else_where_fields[] = $taxonomy; 1405 1405 1406 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 $orderby $limit", $where_fields ), ARRAY_A ) ) { 1406 $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 $orderby $limit", $where_fields ), ARRAY_A ); 1407 if ( $result ) { 1407 1408 return $result; 1408 1409 } … … 1411 1412 } 1412 1413 1413 if ( $result = $wpdb->get_var( $wpdb->prepare( "SELECT term_id FROM $wpdb->terms as t WHERE $where $orderby $limit", $where_fields ) ) ) { 1414 $result = $wpdb->get_var( $wpdb->prepare( "SELECT term_id FROM $wpdb->terms as t WHERE $where $orderby $limit", $where_fields ) ); 1415 if ( $result ) { 1414 1416 return $result; 1415 1417 } … … 1751 1753 $term = (int) $term; 1752 1754 1753 if ( ! $ids = term_exists( $term, $taxonomy ) ) { 1755 $ids = term_exists( $term, $taxonomy ); 1756 if ( ! $ids ) { 1754 1757 return false; 1755 1758 } … … 2449 2452 } 2450 2453 2451 if ( ! $term_info = term_exists( $term, $taxonomy ) ) { 2454 $term_info = term_exists( $term, $taxonomy ); 2455 if ( ! $term_info ) { 2452 2456 // Skip if a non-existent term ID is passed. 2453 2457 if ( is_int( $term ) ) { … … 2608 2612 } 2609 2613 2610 if ( ! $term_info = term_exists( $term, $taxonomy ) ) { 2614 $term_info = term_exists( $term, $taxonomy ); 2615 if ( ! $term_info ) { 2611 2616 // Skip if a non-existent term ID is passed. 2612 2617 if ( is_int( $term ) ) { … … 3544 3549 $ancestors[ $term->term_id ] = 1; 3545 3550 3546 if ( $children = _get_term_children( $term->term_id, $terms, $taxonomy, $ancestors ) ) { 3551 $children = _get_term_children( $term->term_id, $terms, $taxonomy, $ancestors ); 3552 if ( $children ) { 3547 3553 $term_list = array_merge( $term_list, $children ); 3548 3554 } … … 3681 3687 $object_types = array_unique( $object_types ); 3682 3688 3683 if ( false !== ( $check_attachments = array_search( 'attachment', $object_types ) ) ) { 3689 $check_attachments = array_search( 'attachment', $object_types ); 3690 if ( false !== $check_attachments ) { 3684 3691 unset( $object_types[ $check_attachments ] ); 3685 3692 $check_attachments = true; … … 3949 3956 // Split term data recording is slow, so we do it just once, outside the loop. 3950 3957 $split_term_data = get_option( '_split_terms', array() ); 3951 $skipped_first_term = $taxonomies = array(); 3958 $skipped_first_term = array(); 3959 $taxonomies = array(); 3952 3960 foreach ( $shared_tts as $shared_tt ) { 3953 3961 $term_id = intval( $shared_tt->term_id ); … … 4386 4394 */ 4387 4395 function is_object_in_term( $object_id, $taxonomy, $terms = null ) { 4388 if ( ! $object_id = (int) $object_id ) { 4396 $object_id = (int) $object_id; 4397 if ( ! $object_id ) { 4389 4398 return new WP_Error( 'invalid_object', __( 'Invalid object ID.' ) ); 4390 4399 } … … 4412 4421 $terms = (array) $terms; 4413 4422 4414 if ( $ints = array_filter( $terms, 'is_int' ) ) { 4423 $ints = array_filter( $terms, 'is_int' ); 4424 if ( $ints ) { 4415 4425 $strs = array_diff( $terms, $ints ); 4416 4426 } else { … … 4559 4569 4560 4570 // Now look for larger loops. 4561 if ( ! $loop = wp_find_hierarchy_loop( 'wp_get_term_taxonomy_parent_id', $term_id, $parent, array( $taxonomy ) ) ) { 4571 $loop = wp_find_hierarchy_loop( 'wp_get_term_taxonomy_parent_id', $term_id, $parent, array( $taxonomy ) ); 4572 if ( ! $loop ) { 4562 4573 return $parent; // No loop 4563 4574 }
Note: See TracChangeset
for help on using the changeset viewer.