How to return 404 when called edit-comments.php?

There are several ways you can approach this. I wouldn’t recommend deleting edit-comments.php as this is changing the core files, and your changes will be lost when you update WordPress.

htaccess

301 Redirect /wp-admin/edit-comments.php http://www.example.com/wp-admin/

OR functions.php

Part 1

// Redirect any user trying to access comments page
function custom_disable_comments_admin_menu_redirect() {
    global $pagenow;
    if ($pagenow === 'edit-comments.php') {
        wp_redirect(admin_url()); exit;
    }
}
add_action('admin_init', 'custom_disable_comments_admin_menu_redirect');

Part 2

// Remove the menu item for comments from the side
function custom_disable_comments_admin_menu() {
    remove_menu_page('edit-comments.php');
}
add_action('admin_menu', 'custom_disable_comments_admin_menu');

Part 3

// Remove comments links from admin bar
function custom_disable_comments_admin_bar() {
    if (is_admin_bar_showing()) {
        remove_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60);
    }
}
add_action('init', 'custom_disable_comments_admin_bar');

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