Limit number of posts in loop
I consider the right way could be filtering of total number of found posts like this. function my_custom_found_posts_limiter( $found_posts, $wp_query ) { $maximum_of_post_items = 100; // place your desired value here or read if from option\setting. if ( ! is_admin() && $wp_query->is_main_query() && $wp_query->is_post_type_archive( ‘blog_posts’ ) ) { if ( $found_posts > $maximum_of_post_items ) { … Read more