What does “object_id” means?

Problem: User wants to know about object id. He read database description- http://codex.wordpress.org/Database_Description#Table:_wp_terms, and get the table description:

Table: wp_term_relationships
Field Type Null Key Default Extra
object_id bigint(20) PRI Pt1 0
term_taxonomy_id bigint(20) PRI Pt2, IND 0

He know term_taxonomy_id is FK->wp_term_taxonomy.term_taxonomy_id, but how about object_id?
He has a further question:where are “object_id” from? He checked the table “wp_posts” and “wp_links” and found no fields relative to “object_id”.

Solution 1: A quote from: http://boren.nu/
“object_id” is the ID of a post or link. “term_taxonomy_id” is an ID from the term_taxonomy table designating a particular term+taxonomy pair.

Solution 2: In wp_posts, there is an ID column. In wp_links, there’s a link_id column.Those are the connections to the object_id in the wp_term_relationships table. term_relationships basically acts as a connection between the objects (posts or pages) and the various terms attached to those objects (tags or categories or link_categories).

Solution 3: They are the table in question’s primary key. A word to the wise there can be duplicates!!!
My wp_term_relationships Shows the following records with an object_id of 10:
10 – 1
10 – 5
10 – 12
The first two records references a post in wp_posts that has an ID of 10. The third record references a link in wp_links that has a link_id of 10.

Conclusion:
I hope you understand object id from all above solutions. All the above solutions are very accurate. It is easy for anyone to understand object id from above stated solutions.

Leave a Reply

Your email address will not be published. Required fields are marked *