Why get_posts() not returning only selected category posts from Custom Post Type?
First, your custom post type is portfolio-item, not portfolio_item. Note that you register the post type with $this->base name and previously you did $this->base=”portfolio-item”;. Also, numberposts is obsolete, use post_per_page instead: $args = array( // ‘post_type’ => ‘portfolio_item’, ‘post_type’ => ‘portfolio-item’, ‘orderby’ => ‘rand’, ‘post_per_page’ => 1 ); Then, the taxomy argument of your query … Read more