{"id":2168,"date":"2025-05-01T10:53:05","date_gmt":"2025-05-01T03:53:05","guid":{"rendered":"https:\/\/mahfudly.com\/?p=2168"},"modified":"2025-05-01T13:51:00","modified_gmt":"2025-05-01T06:51:00","slug":"how-to-disable-comments-in-wordpress-permanently-without-a-plugin-or-using-a-plugin","status":"publish","type":"post","link":"https:\/\/mahfudly.com\/en\/how-to-disable-comments-in-wordpress-permanently-without-a-plugin-or-using-a-plugin\/","title":{"rendered":"How to Disable Comments in WordPress Permanently (Without Plugins or Using Plugins)"},"content":{"rendered":"<h2 class=\"wp-block-heading\">Why Do Comments Still Appear Even Though They Are Not Displayed?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Imagine you are building a company profile website for a client. Everything is neat \u2014 elegant layout, complete pages, no comments on every post. But one day, you open your dashboard and\u2026 strange comments appear from \u201cCheap Gucci Bag Online\u201d or \u201cWork from Home and Earn $5000 a Week\u201d. Even though you never enabled the comments column.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Huh, how is that possible?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here's what not many beginner WordPress users know: <strong>Comments can be entered directly through the WordPress backend<\/strong>, even if the comments column is not displayed on the frontend. Spambots simply target the file <code>wp-comments-post.php<\/code>, and they can start attacking.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">But don't worry. In this article, you will learn <strong>How to turn off comments in WordPress completely and cleanly<\/strong>, either using <strong>manual<\/strong> or <strong>plugin<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to Disable WordPress Comments Manually<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. Disable Comments in WordPress Settings<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">These are the most basic steps:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Enter the menu <strong>Settings \u2192 Discussion<\/strong><\/li>\n\n\n\n<li>Uncheck:\n<ul class=\"wp-block-list\">\n<li><em>&#8220;Allow people to submit comments on new posts&#8221;<\/em><\/li>\n\n\n\n<li><em>&#8220;Allow link notifications from other blogs (pingbacks and trackbacks)&#8221;<\/em><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Click <strong>Save Changes<\/strong><\/li>\n<\/ul>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Note: this only applies to posts that <strong>newly created<\/strong>, not an old post.<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">2. Turn off Comments on Old Posts and Pages (Bulk Edit)<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To ensure all old content does not receive comments:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Enter the <strong>Posts \u2192 All Posts<\/strong><\/li>\n\n\n\n<li>Check all \u2192 select <strong>Edit (bulk)<\/strong> \u2192 click <strong>Apply<\/strong><\/li>\n\n\n\n<li>In the \u201cComments\u201d option, select <strong>Do not allow<\/strong><\/li>\n\n\n\n<li>Click <strong>Update<\/strong><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Repeat this step in the <strong>Pages<\/strong> too.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. Block Access to WordPress Comments Files<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If you really want to prevent bot spam:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Open file <code>.htaccess<\/code> in your WordPress root folder, then add the following code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;Files wp-comments-post.php&gt;\nOrder Deny,Allow\nDeny from all\n&lt;\/Files&gt;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">With this, access to the WordPress comment endpoint will be completely blocked. Spam bots will not be able to \u201cinfiltrate\u201d through the back door.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4. Turn off comments via script in theme (Advanced)<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If you understand code and want to be \u201ccleaner\u201d without plugins, add this code to the file <code>functions.php<\/code> of your active theme:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Disable support for comments and trackbacks in all post types\nfunction disable_comments_post_types_support() {\n    foreach (get_post_types() as $post_type) {\n        if (post_type_supports($post_type, 'comments')) {\n            remove_post_type_support($post_type, 'comments');\n            remove_post_type_support($post_type, 'trackbacks');\n        }\n    }\n}\nadd_action('admin_init', 'disable_comments_post_types_support');\n\nfunction disable_comments_status() {\n    return false;\n}\nadd_filter('comments_open', 'disable_comments_status', 20, 2);\nadd_filter('pings_open', 'disable_comments_status', 20, 2);\n\nfunction disable_comments_hide_existing_comments($comments) {\n    return array();\n}\nadd_filter('comments_array', 'disable_comments_hide_existing_comments', 10, 2);\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The result? Comments will be disabled completely across the WordPress system.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to Disable Comments Using a Plugin<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Recommended Plugins: <a href=\"https:\/\/wordpress.org\/plugins\/disable-comments\/\" target=\"_blank\" rel=\"noopener\">Disable Comments<\/a><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If you want a faster, more practical way that doesn't require you to touch the code:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Install plugin <strong>Disable Comments<\/strong><\/li>\n\n\n\n<li>Enter the menu <strong>Settings \u2192 Disable Comments<\/strong><\/li>\n\n\n\n<li>Choose: <strong>Everywhere<\/strong> to disable comments on all post types<\/li>\n\n\n\n<li>Click <strong>Save Changes<\/strong><\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">This plugin will:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Remove \u201cComments\u201d menu from dashboard<\/li>\n\n\n\n<li>Disable comments endpoint<\/li>\n\n\n\n<li>Remove comments feature on posts, pages, media, and more<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Highly recommended for <strong>company profile, online store, atau landing page websites<\/strong> which does not require discussion features.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why Do You Need to Turn Off Comments?<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Avoid spam coming in via bots<\/li>\n\n\n\n<li>Speed \u200b\u200bup page loading (because no comment queries)<\/li>\n\n\n\n<li>Improve website professionalism (especially for business)<\/li>\n\n\n\n<li>Protecting brand reputation from spam comments that get through the filter<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion: Which is the Best?<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Method<\/th><th>Perfect for<\/th><\/tr><\/thead><tbody><tr><td>Manual via settings<\/td><td>New user, want a simple way<\/td><\/tr><tr><td>Edit .htaccess<\/td><td>Developers who want to prevent bot spam<\/td><\/tr><tr><td>Add script in theme<\/td><td>Web developer\/agency with full access to code<\/td><\/tr><tr><td>Plugin Disable Comments<\/td><td>Anyone who wants practical and fast<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">If you don't want to bother, just use the plugin <strong>Disable Comments<\/strong>. But if you are building a website for a client and want full control, <strong>use a combination of scripts + settings<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Want your website to look professional and be safe from spam?<br>Mahfudly is ready to help create a <strong>modern company profile website<\/strong>, <strong>no spam comments<\/strong>, and <strong>with extra security system<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u27a1\ufe0f <a href=\"https:\/\/mahfudly.com\/en\/\">View our Portfolio<\/a> or <a href=\"https:\/\/mahfudly.com\/en\/contact\/\">Contact Us Now<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>Kenapa Komentar Masih Muncul Padahal Tidak Ditampilkan? Bayangkan kamu sedang membangun website company profile untuk klien. Semuanya sudah rapi \u2014 tampilan elegan, halaman lengkap, tidak ada kolom komentar di setiap postingan. Tapi suatu hari, kamu membuka dashboard dan&#8230; muncul komentar aneh dari &#8220;Cheap Gucci Bag Online&#8221; atau &#8220;Work from Home and Earn $5000 a Week&#8221;. [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":2179,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[75],"tags":[],"class_list":["post-2168","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorial"],"acf":[],"_links":{"self":[{"href":"https:\/\/mahfudly.com\/en\/wp-json\/wp\/v2\/posts\/2168","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mahfudly.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mahfudly.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mahfudly.com\/en\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/mahfudly.com\/en\/wp-json\/wp\/v2\/comments?post=2168"}],"version-history":[{"count":3,"href":"https:\/\/mahfudly.com\/en\/wp-json\/wp\/v2\/posts\/2168\/revisions"}],"predecessor-version":[{"id":2180,"href":"https:\/\/mahfudly.com\/en\/wp-json\/wp\/v2\/posts\/2168\/revisions\/2180"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/mahfudly.com\/en\/wp-json\/wp\/v2\/media\/2179"}],"wp:attachment":[{"href":"https:\/\/mahfudly.com\/en\/wp-json\/wp\/v2\/media?parent=2168"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mahfudly.com\/en\/wp-json\/wp\/v2\/categories?post=2168"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mahfudly.com\/en\/wp-json\/wp\/v2\/tags?post=2168"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}