Skip to main content
1 of 3
Tom J Nowell
  • 60.6k
  • 7
  • 77
  • 147

Your filter has a bug in it, namely when you call is_main_query, you're not checking if the passed query is the main query, your checking if the currently active query is the main query, which will always be true.

So instead try this:

add_action( 'pre_get_posts', 'some_name');
function some_name($query) {
    if ($query->is_front_page() && $query->is_main_query()) {
        $query->set( 'post_type', 'some_post_type' );
        return;
    }
}
Tom J Nowell
  • 60.6k
  • 7
  • 77
  • 147