Support » Alpha/Beta/RC » query_posts with 2.1?

  • Hi there,

    I just upgraded to 2.1 (final, from the download section).

    I use query_posts extensively throughout my site, and after the upgrade, things seem to have gone a little screwy.

    <?php query_posts('cat=6,9,11&showposts=5'); ?>
    worked fine in 2.0, but now that code generates an error:

    WordPress database error: [Column 'category_id' in where clause is ambiguous]
    SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts LEFT JOIN wp_post2cat ON (wp_posts.ID = wp_post2cat.post_id) LEFT JOIN wp_post2cat ec3_post2cat ON ec3_post2cat.post_id=id WHERE 1=1 AND category_id IN (6, 9, 11) AND (post_type = 'post' AND (post_status = 'publish' OR post_status = 'private')) AND ec3_post2cat.category_id!=36 GROUP BY wp_posts.ID ORDER BY post_date DESC LIMIT 0, 5

    If I change “cat” to “category_id”, there is no error, but each post shows up twice and it doesn’t appear to be grabbing posts from the category, just the newest ones.

    If I was too vague on the details, please let me know and I’ll provide more information.

    Thanks in advance for the help.

Viewing 1 replies (of 1 total)
  • <?php query_posts('category_name=CHANGE&posts_per_page=-1'); while (have_posts()) { the_post(); ?>
    		  <?php } ?>

    Try this

Viewing 1 replies (of 1 total)
  • The topic ‘query_posts with 2.1?’ is closed to new replies.