Changeset 43492 for branches/4.9/src/wp-includes/class-wp-term-query.php
- Timestamp:
- 07/17/2018 04:27:12 PM (7 years ago)
- Location:
- branches/4.9
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.9
- Property svn:mergeinfo changed
/trunk merged: 43049,43491
- Property svn:mergeinfo changed
-
branches/4.9/src/wp-includes/class-wp-term-query.php
r43314 r43492 673 673 if ( false !== $cache ) { 674 674 if ( 'all' === $_fields || 'all_with_object_id' === $_fields ) { 675 $cache = array_map( 'get_term',$cache );675 $cache = $this->populate_terms( $cache ); 676 676 } 677 677 … … 805 805 806 806 if ( 'all' === $_fields || 'all_with_object_id' === $_fields ) { 807 $terms = array_map( 'get_term',$terms );807 $terms = $this->populate_terms( $terms ); 808 808 } 809 809 … … 967 967 return $wpdb->prepare( '((t.name LIKE %s) OR (t.slug LIKE %s))', $like, $like ); 968 968 } 969 970 /** 971 * Creates an array of term objects from an array of term IDs. 972 * 973 * Also discards invalid term objects. 974 * 975 * @since 4.9.8 976 * 977 * @param array $term_ids Term IDs. 978 * @return array 979 */ 980 protected function populate_terms( $term_ids ) { 981 $terms = array(); 982 983 if ( ! is_array( $term_ids ) ) { 984 return $terms; 985 } 986 987 foreach ( $term_ids as $key => $term_id ) { 988 $term = get_term( $term_id ); 989 if ( $term instanceof WP_Term ) { 990 $terms[ $key ] = $term; 991 } 992 } 993 994 return $terms; 995 } 969 996 }
Note: See TracChangeset
for help on using the changeset viewer.