Return WP_Term objects from get_terms().

Props boonebgorges, flixos90, DrewAPicture.
See #14162.
Built from https://develop.svn.wordpress.org/trunk@34998


git-svn-id: http://core.svn.wordpress.org/trunk@34963 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Boone Gorges 2015-10-10 02:13:28 +00:00
parent 623e467712
commit 71429da5b4
2 changed files with 7 additions and 4 deletions

View File

@ -991,7 +991,8 @@ function get_term_to_edit( $id, $taxonomy ) {
* @since 2.3.0 * @since 2.3.0
* @since 4.2.0 Introduced 'name' and 'childless' parameters. * @since 4.2.0 Introduced 'name' and 'childless' parameters.
* @since 4.4.0 Introduced the ability to pass 'term_id' as an alias of 'id' for the `orderby` parameter. * @since 4.4.0 Introduced the ability to pass 'term_id' as an alias of 'id' for the `orderby` parameter.
* Introduced the 'meta_query' and 'update_term_meta_cache' parameters. * Introduced the 'meta_query' and 'update_term_meta_cache' parameters. Converted to return
* a list of WP_Term objects.
* *
* @global wpdb $wpdb WordPress database abstraction object. * @global wpdb $wpdb WordPress database abstraction object.
* @global array $wp_filter * @global array $wp_filter
@ -1052,8 +1053,8 @@ function get_term_to_edit( $id, $taxonomy ) {
* @type array $meta_query Meta query clauses to limit retrieved terms by. * @type array $meta_query Meta query clauses to limit retrieved terms by.
* See `WP_Meta_Query`. Default empty. * See `WP_Meta_Query`. Default empty.
* } * }
* @return array|int|WP_Error List of Term Objects and their children. Will return WP_Error, if any of $taxonomies * @return array|int|WP_Error List of WP_Term instances and their children. Will return WP_Error, if any of $taxonomies
* do not exist. * do not exist.
*/ */
function get_terms( $taxonomies, $args = '' ) { function get_terms( $taxonomies, $args = '' ) {
global $wpdb; global $wpdb;
@ -1493,6 +1494,8 @@ function get_terms( $taxonomies, $args = '' ) {
foreach ( $terms as $term ) { foreach ( $terms as $term ) {
$_terms[ $term->term_id ] = $term->slug; $_terms[ $term->term_id ] = $term->slug;
} }
} else {
$_terms = array_map( 'get_term', $terms );
} }
if ( ! empty( $_terms ) ) { if ( ! empty( $_terms ) ) {

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.4-alpha-34997'; $wp_version = '4.4-alpha-34998';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.