Changeset 63354 for trunk/src/wp-includes/class-wp-term.php
- Timestamp:
- 08/26/2026 10:20:49 PM (34 hours ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/class-wp-term.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-term.php
r61789 r63354 104 104 * 105 105 * @since 4.4.0 106 * @since 7.2.0 Cache values that are not usable as a term object are now treated as a cache miss and replaced. 106 107 * 107 108 * @global wpdb $wpdb WordPress database abstraction object. … … 124 125 $_term = wp_cache_get( $term_id, 'terms' ); 125 126 126 // If there isn't a cached version, hit the database. 127 if ( ! $_term || ( $taxonomy && $taxonomy !== $_term->taxonomy ) ) { 127 /* 128 * If there isn't a usable cached version, hit the database. A cached value that is 129 * not a term object, or that belongs to another taxonomy, is treated as a cache miss. 130 */ 131 if ( 132 ! is_object( $_term ) 133 || ! isset( $_term->term_id, $_term->taxonomy ) 134 || ( $taxonomy && $taxonomy !== $_term->taxonomy ) 135 ) { 128 136 // Any term found in the cache is not a match, so don't use it. 129 137 $_term = false; … … 178 186 // Don't cache terms that are shared between taxonomies. 179 187 if ( 1 === count( $terms ) ) { 180 wp_cache_add( $term_id, $_term, 'terms' ); 188 // Not wp_cache_add(), since an unusable cached value may still be present and must be replaced. 189 wp_cache_set( $term_id, $_term, 'terms' ); 181 190 } 182 191 }
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)