Limit the number of posts in query_posts function with custom post types

Something like this is what you need. The Codex page for WP_Query is very helpful

$args = array('post_type' => '<your custom post type name>',
              'posts_per_page' => 5,
               'tax_query' => array(
                                array(
                                  'taxonomy' => '<your custom taxonomy name>',
                                  'field' => 'slug',
                                  'terms' => 'event-england'
                                 )
                           )
         )

$query = new WP_Query($args)

Leave a Comment