// === 1. Disable support for comments and trackbacks in post types === function full_disable_comments_post_types_support() { $post_types = get_post_types(); foreach ($post_types as $post_type) { if (post_type_supports($post_type, 'comments')) { remove_post_type_support($post_type, 'comments'); remove_post_type_support($post_type, 'trackbacks'); } } } add_action('admin_init', 'full_disable_comments_post_types_support'); // === 2. Close comments on the front-end === function full_disable_comments_status() { return false; } add_filter('comments_open', 'full_disable_comments_status', 20, 2); add_filter('pings_open', 'full_disable_comments_status', 20, 2); // === 3. Hide existing comments === function full_disable_comments_hide_existing($comments) { return array(); } add_filter('comments_array', 'full_disable_comments_hide_existing', 10, 2); // === 4. Redirect attempts to post a comment to homepage === function full_redirect_comment_post_to_home() { if (isset($_POST['comment'])) { wp_redirect(home_url()); exit; } } add_action('pre_comment_on_post', 'full_redirect_comment_post_to_home'); // === 5. Remove comments page in admin menu === function full_disable_comments_admin_menu() { remove_menu_page('edit-comments.php'); } add_action('admin_menu', 'full_disable_comments_admin_menu'); // === 6. Redirect users trying to access comments page in admin === function full_disable_comments_admin_redirect() { global $pagenow; if ($pagenow === 'edit-comments.php' || $pagenow === 'comment.php') { wp_redirect(home_url()); exit; } } add_action('admin_init', 'full_disable_comments_admin_redirect'); // === 7. Remove comments metabox from dashboard === function full_disable_comments_dashboard() { remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal'); } add_action('admin_init', 'full_disable_comments_dashboard'); // === 8. Remove comment-related links from admin bar === function full_disable_comments_admin_bar() { if (is_admin_bar_showing()) { remove_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60); } } add_action('init', 'full_disable_comments_admin_bar'); // === 9. Remove comment form completely from templates === function full_disable_comments_template($comment_template) { // Instead of loading the comments.php template, return an empty string return ''; } add_filter('comments_template', 'full_disable_comments_template');