Support » Fixing WordPress » Terms / objects link get lost for some cases.

  • After updating our install from 4.4.2 to 4.8.2, we observed the difference, where some terms were gone for some posts in some cases.

    Might be related to

    I was unable to get the same on stock WP install, but I hope someone could look into that and see some logic missing.

    Around docroot/wp-includes/class-wp-term-query.php:813
    There’s a code:
    if ( ‘all’ === $_fields || ‘all_with_object_id’ === $_fields ) {
    $terms = array_map( ‘get_term’, $terms );

    In some cases this code removes the object_id from Terms in this array.
    I would guess that either it uses cache without object_id or just works on the combined array (some with fields=all and some with fileds=all_with_object_id)

    Not sure what this code was supposed to fix, but to make it work with our taxonomies and terms, we needed to disable it.

    Maybe someone could help me understand what’s that code was supposed to fix and why it might be breaking our terms?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @romsocial – Have a look at and, specifically, some of the troubleshooting steps I provided there. Perhaps you could chime in there with any clues?

    Thread Starter RomSocial


    Hello Boone,
    Thanks for answering so quickly. The symptoms described in your linked issue are exactly same.

    I’ll need to spend more time exploring your latest suggestions.

    I can confirm that this mismatch fires quite rarely, only on some taxonomies in some cases etc. Mismatch is always happening when ‘fields’ is set to all_with_object_id.

    And after the trouble line executes, some terms lose their object_id, some of them get it substituted by another object_id from the array of object_ids.

    I’ll make sure to go through your debugging steps and report back next week, after I’m back at work.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Terms / objects link get lost for some cases.’ is closed to new replies.