Skip to content

Instantly share code, notes, and snippets.

@danielbachhuber
Created May 15, 2019 16:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielbachhuber/055d16358c16e22d6f0a46299a60a09c to your computer and use it in GitHub Desktop.
Save danielbachhuber/055d16358c16e22d6f0a46299a60a09c to your computer and use it in GitHub Desktop.
Disable comments entirely from the WordPress backend
<?php
add_filter( 'comments_open', '__return_false' );
add_action( 'admin_menu', function(){
global $menu;
// Remove Comments
if ( isset( $menu[25] ) ) {
unset( $menu[25] );
}
}, 100 );
add_action( 'admin_bar_menu', function( $wp_admin_bar ) {
$wp_admin_bar->remove_node( 'comments' );
}, 200 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment