How to Disable Comments In WordPress

Written by Nika

Massive Dynamic

Updated January 01,2025

In this article, we will explain how to disable comments on the whole website.
1. Navigate to the WordPress dashboard >> plugins >> Add new

 

 

2. Install and activate the file manager plugin

 

 

3. Open file manager plugin from WordPress dashboard.

 

 

4. Navigate to the wp-content\themes\massive-dynamic
5. Open functions.php file into the “code editor” mode.

 

 

6. Add the below codes into the function.php file and save it.

// Close comments on the front-end
function df_disable_comments_status() {
return false;
}
add_filter(‘comments_open’, ‘df_disable_comments_status’, 20, 2);
add_filter(‘pings_open’, ‘df_disable_comments_status’, 20, 2);

// Hide existing comments
function df_disable_comments_hide_existing_comments($comments) {
$comments = array();
return $comments;
}
add_filter(‘comments_array’, ‘df_disable_comments_hide_existing_comments’, 10, 2);

 

 

Related Articles:

  1. How to Set Styles for Single Posts in Massive Dynamic
  2. How to Set Up a Mega Menu in Massive Dynamic
  3. How to Link a Portfolio Item to an External Page in Massive Dynamic
  4. How to Add HTML and JavaScript to a Page in Massive Dynamic
  5. How to Add a Custom Shortcode to Visual Composer
  6. How to Switch a Header Menu Item to a Button in Massive Dynamic
  7. How to Add a Link to the Copyright Text in Massive Dynamic
  8. Overview of Portfolio Details in Massive Dynamic
  9. How to Switch from Child Theme to Main Theme in Massive Dynamic
  10. How to Update Massive Dynamic Theme While Using a Child Theme

If you encounter any issues during the process, our support team is available to assist you.

Hey Design Lovers !

Unlock Pixflow Max Annually
with 30% OFF
Use code "Newcomer30"

Get 30% OFF