Skip Navigation
Madison, Wisconsin
Powderkeg Web Design
July 15, 2016

Quickly and Easily Remove Comments in the Backend of Wordpress

Nick
Nick
Quickly and Easily Remove Comments in the Backend of Wordpress

Sometimes we create sites for clients that either don’t have a blog section or do not want / need comments in that blog section. For those clients, I like to remove access to the comments in the admin menu and page / posts so it doesn’t clutter up the screen or confuse anyone. It only takes 3 actions / functions:

	/*
	* COMMENTS
	* Remove comments in its entirety
	*/

	// Removes from admin menu
	add_action( 'admin_menu', 'pk_remove_admin_menus' );
	function pk_remove_admin_menus() {
	    remove_menu_page( 'edit-comments.php' );
	}

	// Removes from post and pages
	add_action('init', 'pk_remove_comment_support', 100);
 	function pk_remove_comment_support() {
	   remove_post_type_support( 'post', 'comments' );
	   remove_post_type_support( 'page', 'comments' );
	}

	// Removes from admin bar
	add_action( 'wp_before_admin_bar_render', 'pk_remove_comments_admin_bar' );
	function pk_remove_comments_admin_bar() {
	    global $wp_admin_bar;
	    $wp_admin_bar->remove_menu('comments');
	}

These functions, in order, do the follow:

pk_remove_admin_menus: Removes the comments menu item from the main admin menu.

pk_remove_comment_support: Removes comments as a supported feature for the default page and post post-types.

pk_remove_comments_admin_bar: Removes the comments quick link on the admin bar that appear at the top of the front end when you are logged in

That should be make it very difficult for users to stumble upon comments / become confused by them. Enjoy!

Nick Kalscheur

Nick Kalscheur

Lead Developer