After hours of trying to fix this, I haven’t been able to do it. I know this question has been answered here, but after trying the proposed solutions, I cannot get it to work. No matter if I set numberpost to -1 or 1000, I always get the default 10 posts from
get_post(). I know for sure that I have more than 10 posts that would be returned by this query. This is my code:
$args = array( 'post_type' => 'cp_library', 'numberposts' => -1, 'tax_query' => array( array( 'taxonomy' => 'cp_library', 'field' => 'slug', 'terms' => array('basic') ) ) ); $posts_list = get_posts($args); print_r(count($posts_list));//Prints 10
It seems to me that I’m doing things the right way, according to the codex and other answers here, but nonetheless, it is not working.
Any help is highly appreciated.