WordPress.org

Ready to get started?Download WordPress

Forums

Pages & Posts both listed under Recent Posts (2 posts)

  1. gcjohn1065
    Member
    Posted 6 years ago #

    Both posts and pages are stored the the table wp_posts, but the post_category field is always set to 0 and is not updated when a new post is created. Consequently, even if I amend the line below to select post_categories where the value is more than 0, all pages and posts are listed as being "RECENT POSTS".

    $recentposts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'publish' AND post_date_gmt < '$today' ORDER BY post_date DESC LIMIT 10")

    So far the only work around I can do is to update the post_category manually. Anybody know how to alter the code to get post_category updated when new posts are created?

  2. MichaelH
    Member
    Posted 6 years ago #

    WordPress 2.3 has a whole new table structure for categories. Please check Otto42's reponse here for an understanding of that new structure:
    http://wordpress.org/support/topic/137793?replies=8#post-628701

Topic Closed

This topic has been closed to new replies.

About this Topic