Remove Permalink of certain posts

if you want to redirect a few posts to 404 page then you can use use the following snippet in functions.php of your child theme.

add_action( 'template_redirect', 'post_redirect_func' );
function post_redirect_func(){
    global $post;
    $redirect_url = get_template_part( 404 ); // you can write here the page to redirect if this don't work for you
    if ($post->ID == "IDOFPOST1" || $post->ID == "IDOFPOST2"){ // you can add more id by adding || $post->ID == "IDOFPOST3" before )
        wp_safe_redirect( $redirect_url, 302 );
        exit;
    }
}

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