Support » Developing with WordPress » What does “object_id” means?

Viewing 6 replies - 1 through 6 (of 6 total)
  • A quote from:

    “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.

    Thank mfields for your response.

    I have a further question:where are “object_id” from? I check the table “wp_posts” and “wp_links” and found no fields relative to “object_id”.


    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    In wp_posts, there’s 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 links) and the various terms attached to those objects (tags or categories or link_categories).

    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.

    EDIT: sorry – was typing for a long time. didn’t see other posting

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    That’s okay, there can be duplicates of object_id (and also duplicates of term_taxonomy_id), but it doesn’t matter in this case because the terms themselves are separated into multiple taxonomies. Tags and categories can only attach to posts. link_categories can only attach to links. These are defined with different taxonomies (using the taxonomy column in the term_taxonomy table).

    In your given case, term_taxonomy 1 and term_taxonomy 5 have a taxonomy of either “tag” or “category”. term_taxonomy 12 has a taxonomy of “link_category”.

    Also note that because of this, there cannot be duplicates of the primary key, because it includes both the object_id and the term_taxonomy_id, and each term_taxonomy entry falls into only one taxonomy.

    I am trying to import some content from drupal and nuke, but the wp_term_relationships is making this task very difficult. I was able to import all the content in the wp_posts, without any difficulty. But the association with the keywords is nearly impossible.

    Any ideas how the wp_term_taxonomy table can be generated so that it can carry over to the term_relationships?


Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘What does “object_id” means?’ is closed to new replies.