• Resolved deko

    (@deko)


    Why is the post_category field 0 for all my posts in the wp-posts table? I’ve assigned everything to a category and can see the id’s in the admin pages.

    I’m looking for a way to construct a select statement that will count all posts in a particular category.

    can’t use template tag here…

Viewing 3 replies - 1 through 3 (of 3 total)
  • Assignment of categories to posts is in the wp_post2cat table. This allows for multiple categories per post.

    I’m not at all sure what the post_category field is there for.

    Thread Starter deko

    (@deko)

    10-4. Thanks!

    Thread Starter deko

    (@deko)

    Actually, there is a category_count field in the wp-category table that provides the total posts in each category.

    The real problem is trying to get can aggregate comment count for each categroy… because there is no category_id FK in the wp-categories table… because a comment can belong to a post in multiple categories…

    I guess an aggregate comment count would be meaningless anyway. You could have 10 comments and 10 categories total in your database, and each category would show a total of 10 comments if the post was in all 10 categories – so you would think you had 100 comments when you only had 10.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘post_category field in wp_posts table – why all zeros?’ is closed to new replies.