populate_terms example

 elseif ( 'count' !== $_fields ) {
                if ( ( 'all_with_object_id' === $_fields && ! empty( $args['object_ids'] ) )
                    || ( 'all' === $_fields && $args['pad_counts'] )
                ) {
                    $term_ids = wp_list_pluck( $cache, 'term_id' );
                } else {
                    $term_ids = array_map( 'intval', $cache );
                }

                _prime_term_caches( $term_ids$args['update_term_meta_cache'] );

                $term_objects = $this->populate_terms( $cache );
                $cache        = $this->format_terms( $term_objects$_fields );
            }

            $this->terms = $cache;
            return $this->terms;
        }

        if ( 'count' === $_fields ) {
            $count = $wpdb->get_var( $this->request ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared             wp_cache_set( $cache_key$count, 'term-queries' );
            return $count;
        }
Home | Imprint | This part of the site doesn't use cookies.