[wp-trac] [WordPress Trac] #63618: `is_object_in_term` object cache uses "set" instead of "add"

WordPress Trac noreply at wordpress.org
Mon Jun 23 19:41:25 UTC 2025


#63618: `is_object_in_term` object cache uses "set" instead of "add"
--------------------------+-----------------------------
 Reporter:  nlemoine      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Cache API     |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 `is_object_in_term` should respect
 [`wp_suspend_cache_addition`](https://developer.wordpress.org/reference/functions/wp_suspend_cache_addition/)
 and use `wp_cache_add` instead of `wp_cache_set` as in
 [`get_the_terms`](https://github.com/WordPress/WordPress/blob/c6041fd40a9d499a5d602be791349068699ef695
 /wp-includes/category-template.php#L1297-L1303)

 Blamed line:
 https://github.com/WordPress/WordPress/blob/c6041fd40a9d499a5d602be791349068699ef695
 /wp-includes/taxonomy.php#L4895


 I stumbled upon this building a long running WP-CLI command and noticed a
 memory leak issue while having object cache suspended. Turns out I had a
 `has_category` that filled the whole cache with `category_relationships`
 keys.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63618>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list