Taxonomy: Stop warming term meta cache unnecessarily.
Prevent several core function calls to `get_terms()` from warming the term meta cache. Props peterwilsoncc, boonebgorges, jrf. Fixes #43142. Built from https://develop.svn.wordpress.org/trunk@42649 git-svn-id: http://core.svn.wordpress.org/trunk@42478 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
0d39b35c11
commit
8f0ab2efb8
|
@ -2150,6 +2150,7 @@ function wp_insert_term( $term, $taxonomy, $args = array() ) {
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'hide_empty' => false,
|
'hide_empty' => false,
|
||||||
'parent' => $args['parent'],
|
'parent' => $args['parent'],
|
||||||
|
'update_term_meta_cache' => false,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -2175,6 +2176,7 @@ function wp_insert_term( $term, $taxonomy, $args = array() ) {
|
||||||
$taxonomy, array(
|
$taxonomy, array(
|
||||||
'get' => 'all',
|
'get' => 'all',
|
||||||
'parent' => $parent,
|
'parent' => $parent,
|
||||||
|
'update_term_meta_cache' => false,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -2366,6 +2368,7 @@ function wp_set_object_terms( $object_id, $terms, $taxonomy, $append = false ) {
|
||||||
$object_id, $taxonomy, array(
|
$object_id, $taxonomy, array(
|
||||||
'fields' => 'tt_ids',
|
'fields' => 'tt_ids',
|
||||||
'orderby' => 'none',
|
'orderby' => 'none',
|
||||||
|
'update_term_meta_cache' => false,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
@ -2454,7 +2457,14 @@ function wp_set_object_terms( $object_id, $terms, $taxonomy, $append = false ) {
|
||||||
if ( ! $append && isset( $t->sort ) && $t->sort ) {
|
if ( ! $append && isset( $t->sort ) && $t->sort ) {
|
||||||
$values = array();
|
$values = array();
|
||||||
$term_order = 0;
|
$term_order = 0;
|
||||||
$final_tt_ids = wp_get_object_terms( $object_id, $taxonomy, array( 'fields' => 'tt_ids' ) );
|
$final_tt_ids = wp_get_object_terms(
|
||||||
|
$object_id,
|
||||||
|
$taxonomy,
|
||||||
|
array(
|
||||||
|
'fields' => 'tt_ids',
|
||||||
|
'update_term_meta_cache' => false,
|
||||||
|
)
|
||||||
|
);
|
||||||
foreach ( $tt_ids as $tt_id ) {
|
foreach ( $tt_ids as $tt_id ) {
|
||||||
if ( in_array( $tt_id, $final_tt_ids ) ) {
|
if ( in_array( $tt_id, $final_tt_ids ) ) {
|
||||||
$values[] = $wpdb->prepare( '(%d, %d, %d)', $object_id, $tt_id, ++$term_order );
|
$values[] = $wpdb->prepare( '(%d, %d, %d)', $object_id, $tt_id, ++$term_order );
|
||||||
|
@ -3385,6 +3395,7 @@ function _get_term_hierarchy( $taxonomy ) {
|
||||||
'get' => 'all',
|
'get' => 'all',
|
||||||
'orderby' => 'id',
|
'orderby' => 'id',
|
||||||
'fields' => 'id=>parent',
|
'fields' => 'id=>parent',
|
||||||
|
'update_term_meta_cache' => false,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
foreach ( $terms as $term_id => $parent ) {
|
foreach ( $terms as $term_id => $parent ) {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.0-alpha-42648';
|
$wp_version = '5.0-alpha-42649';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
|
|
Loading…
Reference in New Issue