Taxonomy: Do not prime term meta in `wp_get_object_terms`.

Passing `update_term_meta_cache` argument value false by default resulting in `get_terms` to not prime the term meta cache in `wp_get_object_terms`. Priming of term meta is not needed in this context. 

Props spacedmonkey, rutviksavsani.
Fixes #57701.
Built from https://develop.svn.wordpress.org/trunk@55759


git-svn-id: http://core.svn.wordpress.org/trunk@55271 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
spacedmonkey 2023-05-16 12:31:21 +00:00
parent a0bcd7d56a
commit b49912434d
2 changed files with 8 additions and 2 deletions

View File

@ -2192,6 +2192,8 @@ function wp_delete_category( $cat_id ) {
* @since 4.4.0 Introduced `$meta_query` and `$update_term_meta_cache` arguments. When `$fields` is 'all' or
* 'all_with_object_id', an array of `WP_Term` objects will be returned.
* @since 4.7.0 Refactored to use WP_Term_Query, and to support any WP_Term_Query arguments.
* @since 6.3.0 Passing `update_term_meta_cache` argument value false by default resulting in get_terms() to not
* prime the term meta cache.
*
* @param int|int[] $object_ids The ID(s) of the object(s) to retrieve.
* @param string|string[] $taxonomies The taxonomy names to retrieve terms from.
@ -2220,7 +2222,11 @@ function wp_get_object_terms( $object_ids, $taxonomies, $args = array() ) {
}
$object_ids = array_map( 'intval', $object_ids );
$args = wp_parse_args( $args );
$defaults = array(
'update_term_meta_cache' => false,
);
$args = wp_parse_args( $args, $defaults );
/**
* Filters arguments for retrieving object terms.

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.3-alpha-55758';
$wp_version = '6.3-alpha-55759';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.