How to Completely Disable Comments on WordPress

You can completely disable comments on your WordPress site by using the code below. It will get rid of comments on both the front end and the back end, so you won't have to deal with comments on WordPress. It's great for developers and site owners who want a clean site with few distractions.

Add the below code to the functions.php file of your active theme:

/* Function to disable comments throughout the site */
function themesdna_disable_comments_admin_init() {
    /* Redirect any user trying to access comments page */
    global $pagenow;
    
    if ($pagenow === 'edit-comments.php') {
        wp_redirect(admin_url());
        exit;
    }

    /* Remove comments metabox from dashboard */
    remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal');

    /* Disable support for comments and trackbacks in post types */
    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');
        }
    }
}

/* Function to remove comments page in menu */
function themesdna_disable_comments_menu_page() {
    remove_menu_page('edit-comments.php');
}

/* Function to remove comments links from admin bar */
function themesdna_disable_comments_admin_bar() {
    if (is_admin_bar_showing()) {
        remove_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60);
    }
}

/* Hook the function to the admin_init action */
add_action('admin_init', 'themesdna_disable_comments_admin_init');

/* Hook the function to remove comments page in menu */
add_action('admin_menu', 'themesdna_disable_comments_menu_page');

/* Hook the function to the init action */
add_action('init', 'themesdna_disable_comments_admin_bar');

/* Close comments on the front-end */
add_filter('comments_open', '__return_false', 20, 2);
add_filter('pings_open', '__return_false', 20, 2);

/* Hide existing comments */
add_filter('comments_array', '__return_empty_array', 10, 2);

Our WordPress Themes

Below are some of our premium WordPress themes. View all our free and premium WordPress themes →
ElegantWP PRO WordPress Theme

ElegantWP PRO

If you like ElegantWP free WordPress Theme, you will love the premium version. ElegantWP PRO is very user friendly, feature-rich,...

$25.00
GridMode PRO WordPress Theme

GridMode PRO

Are you using the GridMode free WordPress Theme and looking for more advanced features? GridMode PRO theme is developed for...

$25.00
GridHot PRO WordPress Theme

GridHot PRO

If you have tried GridHot Free WordPress Theme, then you will love the premium version. GridHot PRO version has color...

$25.00
GridBone PRO WordPress Theme

GridBone PRO

$25.00
GridRead PRO WordPress Theme

GridRead PRO

If you like GridRead Free WordPress Theme, then you will love the premium version. GridRead PRO version has color options,...

$25.00
FlashWP PRO WordPress Theme

FlashWP PRO

If you like FlashWP free WordPress Theme, you will love the premium version. FlashWP PRO is advanced, more user friendly,...

$25.00
PowerWP PRO WordPress Theme

PowerWP PRO

If you like PowerWP free WordPress Theme, you will love the premium version. PowerWP PRO is an easy to use,...

$25.00
MaxWP PRO WordPress Theme

MaxWP PRO

If you like MaxWP free WordPress Theme, you will love the premium version. MaxWP PRO is feature-rich, easy to use,...

$25.00

Can't you choose a single theme? Purchase All Themes for $75.

Save money with our low, one-time price for access to all of our 55 WordPress themes.