YourThe filter has a bug in it, namely when you call is_main_queryit calls is_main_query
, you'reit's not checking if the passed query$query
is the main query, yourit's checking if the currently active querycurrently active query is the main query, which will always be true.
So instead try this:
add_action( 'pre_get_posts', 'modify_frontpage_main_query' );
function modify_frontpage_main_query( \WP_Query $query ) : void {
if ( $query->is_front_page() && $query->is_main_query() ) {
$query->set( 'post_type', 'some_post_type' );
}
}