Æ

Disable comments on all WordPress pages at once

January 04, 2017

Comments on pages by default. Not sure why that is a thing but we’re talking about 13 year old software here. It’s easy enough to turn off comments manually. Page by page. Why do work by hand when you could automate it?

Turns out it’s simple enough to turn off comments on every single page on your site with a couple of lines of code. You can add this to your theme’s functions.php file, your core functionality plugin or wherever else you deem fit.

// Disable comments on all pages
add_action( 'init', function() {
	remove_post_type_support( 'page', 'comments' );
}, 100 );

Stay tuned for more in my series titled “How to fix things that shouldn’t be this way”.


Profile picture

Written by Aaron Eaton