Filter Posts from the Main Query

Untested:

function custom_home_exclude( $where="" ) {
    $exclude = array();
    $newsQuery = new WP_Query (array(
        "post_type"      => "news",
        "meta_key"       => "post_to_blog",
        "meta_value"     => 1,
        "meta_compare"   => "!=",
        "posts_per_page" => "-1",
    ));
    while ($newsQuery->have_posts()) {
        $newsQuery->the_post();
        array_push($exclude, get_the_ID());
    }
    wp_reset_query();
    $exclude = join(',', $exclude);
    $where .= " AND `ID` NOT IN ($exclude)";
    return $where;
}


function custom_home_loop($query) {
    if ($query->is_main_query() && is_home()) {
        $query->set("post_type", array("post", "news"));
        add_filter( 'posts_where', 'custom_home_exclude' );
    }
}
add_filter("pre_get_posts", "custom_home_loop");

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)