It’s not working because the $posts_list
variable is assigned the return value of get_posts()
(i.e. $posts_list = get_posts( ... )
), hence $posts_list
is not actually an array of arguments, but instead, it’s either an array of posts or an empty array.
So to fix the problem, define the $posts_list
like so:
$posts_list = array(
'posts_per_page' => 6,
'post_type' => 'post',
'post_status' => 'publish',
'paged' => $i_paged
);