Close WordPress Comments on All Posts and Pages Temporarily

The following snippet will close commenting throughout the whole website (or network, if network-activated), but will retain the original comment status on all posts and pages, so you can reopen commenting at any time.

add_filter( 'comments_open', '__return_false' );

It might come useful in several cases, like when you’re experiencing a massive attack of comment spam, or perhaps your website is under heavy load, and comments are causing your page cache to get busted. Or maybe you’re just going for vacation and don’t want to end up with a pile of comments you have to respond to when you get back 😉

Leave a Reply

Your email address will not be published. Required fields are marked *