I’ve been researching this for the last 3 days. I’m triyng to limit the maximum amount of posts retrieved by get_posts()
.
I have this chunk of code:
// all filters should be applied here
$args = array(
'nopaging' => true,
'post_type' => get_option('ip_slug'),
'posts_per_page' => $ip_ipp,
'limit' => 100,
'orderby' => $ip_order,
'order' => $ip_order_asc_desc,
'author' => $author,
'suppress_filters' => false,
'meta_key' => $ip_meta,
'meta_query' => array(
array(
'key' => $ip_key,
)
),
'cache_results' => false,
'update_post_term_cache' => false,
'update_post_meta_cache' => false,
'no_found_rows' => true,
);
$posts = get_posts($args);
//
The limit
parameter does not work.
UPDATE #1: I want to use, say, 5
posts per page and use multiple queries on the same page using get_posts()
(not query_posts
, not WP_Query
) and I want to limit the database query to 100
. I can’t use the paged
parameter, due to multiple dynamically created loops.