In a multi-site environment, I have a special need to get post terms (on a custom taxonomy) without the expensive operation of "switching blogs".

I thought I might write my own query to get terms for a given post on a given blog.

I'm looking through the three tables:


Yet I cannot see where there is a connection to post_id in any of these.

So the question:

How do terms link with a given post in the database? If I can know that, I can do the rest.

1 Answer 1


The posts are related to taxonomies (taxonomy/tag) in the wp_3_term_relationships table, where the object_id column is the post's id, and the term_taxonomy_id is the taxonomy/tag id.

Depending on what you want to accomplish, the solution might be to create the same taxonomies at each blog. This way the tax_query should work as normal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.