WordPress number of posts not changing with posts_per_page

I have thousands of posts that i am displaying on my home page. I want to control number of posts so for this i am using posts_per_pagebut it is not working for me.
I am also resetting query before this loop using wp_reset_query(); and tried this code in functions.php as well.

add_action( ‘pre_get_posts’, ‘set_posts_per_page’ );
function set_posts_per_page( $query ) {
global $wp_the_query;
$query->set( ‘posts_per_page’, 10 );
return $query;
}

But nothing working for me. I am using covert store builder theme. Any suggestion will be much appreciated.
Thank you!

Read more here:: WordPress number of posts not changing with posts_per_page

Leave a Reply

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