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);