WordPress.org

Ready to get started?Download WordPress

Forums

i wonder why there is a table named wp_term_relationships (5 posts)

  1. justintime
    Member
    Posted 6 years ago #

    i saw in wordpress database schema that there is a table which holds the postid and category of that post id. why they used this table instead of creating a new column "category" in wp_posts table.

  2. moshu
    Member
    Posted 6 years ago #

    Don't ask it here.
    Join the wp-testers and/or wp-hackers mailing lists and discuss this with the developers, if you think you have a better idea than the present setup.
    http://lists.automattic.com/mailman/listinfo

  3. Kafkaesqui

    Posted 6 years ago #

    There *is* a post_category column in the posts table, however it was deprecated way back when posts were allowed to be assigned to multiple categories in WordPress. To have a single column for this now would be problematic.

  4. justintime
    Member
    Posted 6 years ago #

    @Kafkaesqui: i know that column in wp_posts. if post is assigned to multiple categories, the category ids could be splited with simple ",". i think there is a different reason why extra table is used.

  5. Kafkaesqui

    Posted 6 years ago #

    There is no "different" reason, sorry. Assignment of post to category moved to its own table (originally post2cat, but that changed with WP 2.3) specifically for multiple category support.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags