get_posts() not returning only selected category posts
-
I’m trying to get posts according to their category, but for some odd reason it returns all posts of the custom type:
//here I get each relevant category then proceed to loop trough them: foreach ($categories as $term ) { $idObj = get_category_by_slug($term->slug); $id = $term->term_id; $args = array( 'numberposts' => 5, 'post_type' => 'custom', 'custom_category' => $term->slug , 'post_status' => 'publish'); $myposts = get_posts( $args ); }
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘get_posts() not returning only selected category posts’ is closed to new replies.