Support » Fixing WordPress » Custom type posts display by category

  • I have added a new post type: products and want to list them.

    $args = array(
    'post_type' => 'products',
    'posts_per_page' => 10,
    'cat' => 8
    $recentPosts = new WP_Query($args);

    This is the code I have and I have set the category ID to 8 for testing. But everytime I point to another page:, it changes the output SQL:
    SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) WHERE 1=1 AND ( wp_term_relationships.term_taxonomy_id IN (16,13,14,15) ) 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

  • The topic ‘Custom type posts display by category’ is closed to new replies.