Taxonomy: Ignore cached term value when it doesn't match the queried taxonomy.
When a cache entry is found that matches the requested `$term_id`, but doesn't match an explicitly provided `$taxonomy`, that cache entry should be ignored. Props GunGeekATX. Fixes #40671. Built from https://develop.svn.wordpress.org/trunk@40979 git-svn-id: http://core.svn.wordpress.org/trunk@40829 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
848bcf3b28
commit
ed9d4b9408
|
@ -136,6 +136,9 @@ final class WP_Term {
|
||||||
|
|
||||||
// If there isn't a cached version, hit the database.
|
// If there isn't a cached version, hit the database.
|
||||||
if ( ! $_term || ( $taxonomy && $taxonomy !== $_term->taxonomy ) ) {
|
if ( ! $_term || ( $taxonomy && $taxonomy !== $_term->taxonomy ) ) {
|
||||||
|
// Any term found in the cache is not a match, so don't use it.
|
||||||
|
$_term = false;
|
||||||
|
|
||||||
// Grab all matching terms, in case any are shared between taxonomies.
|
// Grab all matching terms, in case any are shared between taxonomies.
|
||||||
$terms = $wpdb->get_results( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE t.term_id = %d", $term_id ) );
|
$terms = $wpdb->get_results( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE t.term_id = %d", $term_id ) );
|
||||||
if ( ! $terms ) {
|
if ( ! $terms ) {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.9-alpha-40978';
|
$wp_version = '4.9-alpha-40979';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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