• $my_query = new WP_Query(‘showposts=10&category_name=portfolio’);
    This should theoretically return all the posts under the category named “portfolio” but I get all the post returned that is not in the “portfolio” category.

    This query is called:
    SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts WHERE 1=1 AND ( wp_posts.ID NOT IN (
    SELECT object_id
    FROM wp_term_relationships
    WHERE term_taxonomy_id IN (5,6,7,45)
    ) ) AND wp_posts.post_type = ‘post’ AND (wp_posts.post_status = ‘publish’ OR wp_posts.post_status = ‘private’) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 10

    Ideas?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Trying to use this version:

    query_posts('showposts=10&category_name=portfolio');

    Moderator keesiemeijer

    (@keesiemeijer)

    also try:
    $my_query = new WP_Query('posts_per_page=10&category_name=portfolio');

    Have similar problem, this test code doesnt work (called as shortcode):

    $gh_query = new WP_Query('posts_per_page=10&category_name=techblog');
    	while ($gh_query->have_posts())
    	{
    	$gh_query->the_post();
    	$title = $gh_query->the_title_attribute("echo=0");
      	$output = $output.$title."<br>";
    	}
    	return $output;

    Any ideas?

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘WP_Query broken in 3.1’ is closed to new replies.