WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] What does "object_id" means? (7 posts)

  1. hywl51
    Member
    Posted 6 years ago #

    I read database description- http://codex.wordpress.org/Database_Description#Table:_wp_terms, 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

    I know term_taxonomy_id is FK->wp_term_taxonomy.term_taxonomy_id, but how about object_id?

    Thanks
    hywl51

  2. Michael Fields
    Themer
    Posted 6 years ago #

    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.

  3. hywl51
    Member
    Posted 6 years ago #

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

    Thanks
    hywl51

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

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

  5. Michael Fields
    Themer
    Posted 6 years ago #

    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

  6. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    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.

  7. msarkis
    Member
    Posted 6 years ago #

    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?

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags