WordPress.org

Support

Support » Miscellaneous » i wonder why there is a table named wp_term_relationships

i wonder why there is a table named wp_term_relationships

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • 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

    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.

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

    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.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘i wonder why there is a table named wp_term_relationships’ is closed to new replies.