Pagination working everywhere but the index page

No idea why but pagination on my homepage isn’t working although it works in every other place..custom templates, archive, searches. I’ve tried every version of pagination possible it seems. I’ve used wp_query, query_posts, get_posts.

I’ve tried the method of setting temp wp_query and wp_query to null and then adding it again after the pagination.

I’ve tried just setting paged to $paged. The odd thing to me is the same loops works on an older theme I have but not on mine. It works on a page I’ve created using the exact same loop. So I’m looking for some hints on what might be causing this. Here is my loop.

 global $wp_query;
 $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
 $args = array(
    'meta_key' => 'rating',
    'meta_value' => 0,
    'meta_compare' => '>',
    'orderby' => 'meta_value_num',
    'order' => 'DESC',
    'cat' => -1,
    'posts_per_page' => 16, 
    'paged' => $paged,
    'post_type' => array( 'post','videos','articles'  )
 );
$wp_query = new WP_Query($args);
while ( $wp_query->have_posts() ) : $wp_query->the_post();
  get_template_part( 'loop', 'contents' );
endwhile;
?>
<div class="infinitescroll">
  <?php next_posts_link('next posts'); ?>
</div>

I’ve tried setting global $paged. I’ve tried setting the get_query_var to page instead of paged. No dice.

Solutions Collecting From Web of "Pagination working everywhere but the index page"

Using Milo’s suggestion in the comments above fixed the issue. Using pre_get_posts we modify the loop like so.

function filter_main_query( $query ) {

    if( is_front_page() && is_main_query() ) {


        $query->set('meta_key', 'rating');
        $query->set('meta_value', 0 );
            // rest of params

    }

}
add_action('pre_get_posts', 'filter_main_query', 9999);