This website uses cookies to allow us to see how the site is used. If you continue to use this site, we assume that you are okay with this. If you want to use the sites without cookies, please see our privacy policy.

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 *

This site uses Akismet to reduce spam. Learn how your comment data is processed.