WordPress – how to disable comments and pingbacks on multi-sites

The following code will disable commands and pingbacks in WordPress.

add_filter( 'pings_open', '__return_false', 10, 2 );
add_filter( 'comments_open', '__return_false', 10, 2 );

To disable for all multi-site websites, you need run the code inside the /wp-content/mu-plugins folder.

Simple create a new php file inside the folder, for example disable_comments.php

Start the file with an opening

<?php

Then add the code from above.

Commands and pingbacks will now be disabled on all the multi-site websites.

Please note – any existing comments may still be displayed, depending on how your theme is configured. You may need to delete existing comments to completely remove the comments section from pages and posts.