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 →
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
GridNext PRO WordPress Theme

GridNext PRO

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

$25.00
GridView PRO WordPress Theme

GridView PRO

GridView PRO is fully responsive, feature-rich, accessibility improved, more advanced version of its free version. GridView PRO WordPress theme has...

$25.00
TextWP PRO WordPress Theme

TextWP PRO

TextWP PRO is an more improved and advanced version of TextWP Free WordPress Theme. When compare with the TextWP free...

$25.00
Clean Gallery PRO WordPress Theme

Clean Gallery PRO

If you like Clean Gallery free WordPress Theme, you will love the premium version. Clean Gallery PRO is an elegant,...

$25.00
NeatBlog PRO WordPress Theme

NeatBlog PRO

NeatBlog PRO WordPress Theme is the advanced, feature-rich version of the NeatBlog Free WordPress Theme. NeatBlog PRO version has color...

$25.00
BoldWP PRO WordPress Theme

BoldWP PRO

If you have tried BoldWP Free WordPress Theme, then you will love the premium version. BoldWP PRO is an more...

$25.00
GreatWP PRO WordPress Theme

GreatWP PRO

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

$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 56 WordPress themes.