Limit home post to 10 without creating pagination?

I’m trying to display the last 10 posts only on the home without wp creating /page/2, /page/3, archives.

I’ve been testing and it seems if you disable pagination it will just grab everything crashing the server. (Don’t do this at home).

if ( !is_admin() && $query->is_home() && $query->is_main_query() ) {
$query->set( ‘posts_per_page’, 10 );
$query->set( ‘nopaging’ , true );

}

Someone suggested ” no_found_rows=true” that doesn’t do it either.

Is this just impossible to do? It seems like it will either create the pages or show all, there’s no way to “LIMIT” it?

Read more here:: Limit home post to 10 without creating pagination?

Leave a Reply

Your email address will not be published. Required fields are marked *