Tutorials
E
Elementor
16 tutorials
A
AWS Lightsail
Beginner-friendly AWS Lightsail guides
12 tutorials
W
WordPress
12 tutorials
T
Test
1 tutorial
View all tutorials →
Tools
W
Website Platforms & Tools
Tools to build, host, and optimize fast, reliable, and professional websites.
8 tools
W
Web Hosting Providers
Fast, secure web hosting with reliable uptime to power and scale your website.
6 tools
V
VoIP / Communications
Business phone tools with virtual numbers, call routing, and auto-attendants for a professional pres
4 tools
W
Website Security
Security tools to protect your site from threats, malware, and unauthorized access.
2 tools
B
Branding & Logo Design
Create a strong brand identity with custom logo and professional design services.
1 tool
View all tools →

How I Disable Comments in WordPress (Without a Plugin)

Gerry Manzari Written by Gerry Manzari · March 30, 2026 · 1 min read

If you’re not using comments on your WordPress site, there’s no reason to keep that system loaded. Instead of installing a plugin, I prefer to disable comments entirely with a few lines of code. This removes the comment feature from both the frontend and admin, keeping everything cleaner, more lightweight, and eliminating an extra area that could be targeted for spam or abuse.

Once added, comments are completely gone — no comment boxes, no dashboard section, and no leftover comment functionality running in the background.

PHP
/**
 * Disable Comments Everywhere (Frontend + Admin)
 */
add_action('init', function () {
    foreach (get_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_filter('comments_open', '__return_false', 20, 2);
add_filter('pings_open', '__return_false', 20, 2);

add_filter('comments_array', '__return_empty_array', 10, 2);

add_action('admin_menu', function () {
    remove_menu_page('edit-comments.php');
});

add_action('admin_init', function () {
    global $pagenow;
    if ($pagenow === 'edit-comments.php') {
        wp_redirect(admin_url());
        exit;
    }
});

add_action('wp_before_admin_bar_render', function () {
    global $wp_admin_bar;
    $wp_admin_bar->remove_menu('comments');
});

add_filter('manage_posts_columns', function ($columns) {
    unset($columns['comments']);
    return $columns;
});