[wp-trac] [WordPress Trac] #35462: update_term_cache and deleting object_id

WordPress Trac noreply at wordpress.org
Fri Jan 15 03:21:12 UTC 2016


#35462: update_term_cache and deleting object_id
--------------------------+--------------------
 Reporter:  berengerzyla  |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  4.4.2
Component:  Taxonomy      |     Version:  4.4
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+--------------------
Changes (by boonebgorges):

 * version:  4.4.1 => 4.4
 * milestone:  Awaiting Review => 4.4.2


Comment:

 Hi @berengerzyla - Welcome to WordPress Trac! Thanks for opening this
 ticket.

 I think you're correct that this ought to be `clone`. Consider the
 following:

 {{{
 $terms = wp_get_object_terms( $p, array( 'fields' => 'all_with_object_id'
 ) );
 update_term_cache( $terms );
 }}}

 Term objects will have `object_id` set before `update_term_cache()`, but
 not after. This is clearly incorrect. I assume that something like this is
 happening in your case.

 That being said, I've been unable to reproduce exactly what you've
 described. If my hypothesis is correct, one of two things is happening: a
 plugin is filtering 'wp_get_object_terms' or 'get_object_terms' and
 removing the `object_id`, or something is intervening in
 `wp_get_object_terms()` and forcing the items through
 `update_term_cache()`. Your debugging makes it sound as if it's the
 latter, but looking at the code, I can't see how that would happen.

 Is there any chance you can provide a complete stack trace of the call to
 `update_term_cache()` that's causing the by-reference pollution of
 `$_term`? I have a feeling it's being called by something outside of WP
 core, but I want to be sure that's the case before making your suggested
 change.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/35462#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list