Skip to content

Instantly share code, notes, and snippets.

@sagarjadhav
Created July 10, 2013 08:52
Show Gist options
  • Select an option

  • Save sagarjadhav/5964589 to your computer and use it in GitHub Desktop.

Select an option

Save sagarjadhav/5964589 to your computer and use it in GitHub Desktop.
Remove commment support from post, pages, admin menu and admin bar.
<?php
/* Remove Comments Tab from admin menu */
function rtp_remove_admin_menus() {
remove_menu_page('edit-comments.php');
}
add_action('admin_menu', 'rtp_remove_admin_menus');
/* Remove commment support from post and pages */
function rtp_remove_comment_support() {
remove_post_type_support('post', 'comments');
remove_post_type_support('page', 'comments');
}
add_action('init', 'rtp_remove_comment_support', 100);
/* Remove comment link from admin bar */
function rtp_admin_bar_render() {
global $wp_admin_bar;
$wp_admin_bar->remove_menu('comments');
}
add_action('wp_before_admin_bar_render', 'rtp_admin_bar_render');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment