Last active
May 30, 2017 19:52
-
-
Save hearvox/ce382a16334b25649ce22b1ad7a2f0e4 to your computer and use it in GitHub Desktop.
Removes Comments from WordPress admin, inc. Admin Bar, Dashboard, column in Posts/Pages lists, and meta box in Edit Posts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/******************************* | |
=Comments: Remove | |
******************************/ | |
/* Remove comments support from native post types | |
* | |
* Removes Comments column from admin post lists and Comments meta-box from Edit Post. | |
*/ | |
function headecon_remove_comments() { | |
remove_post_type_support( 'post', 'comments' ); | |
remove_post_type_support( 'page', 'comments' ); | |
remove_post_type_support( 'attachment', 'comments' ); | |
} | |
add_action( 'init', 'headecon_remove_comments', 100 ); | |
/* Remove Comments menu page link in Dashboard sidebar | |
* | |
* Menu page still accessible: | |
* @link /wp-admin/edit-comments.php | |
*/ | |
function headecon_remove_menus(){ | |
remove_menu_page( 'edit-comments.php' ); | |
} | |
add_action( 'admin_menu', 'headecon_remove_menus' ); | |
/* Remove comments menu page link in admin bar */ | |
function headecon_admin_bar_rm_menu() { | |
global $wp_admin_bar; | |
$wp_admin_bar->remove_menu( 'comments' ); | |
} | |
add_action( 'wp_before_admin_bar_render', 'headecon_admin_bar_rm_menu' ); | |
/* Remove HTML head link to /comments/feed */ | |
add_filter( 'feed_links_show_comments_feed', '__return_false' ); | |
/* Jetpack Carousel: CSS to Hide Comment Form, Link, and "Loading" message | |
#jp-carousel-comment-form-container, | |
div.jp-carousel-buttons a.jp-carousel-commentlink, | |
div.jp-carousel-image-meta, | |
#jp-carousel-comments-loading { display: none !important; } | |
.jp-carousel-buttons { padding: 0 !important; } | |
*/ | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment