Remove "Comments" link from admin bar if comment status is closed for Wordpress
/**
* Disable 'Comments' link if default status is _closed_
*/
function remove_comments()
{
$default_comment_status = get_option( 'default_comment_status' );
if ( $default_comment_status == 'closed' )
{
remove_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 50 );
// optional solution using the WP_Admin_Bar class from /wp-includes/class-wp-admin-bar.php
# global $wp_admin_bar;
# $wp_admin_bar->remove_menu( 'comments' );
}
else
{
return;
}
}
* Disable 'Comments' link if default status is _closed_
*/
function remove_comments()
{
$default_comment_status = get_option( 'default_comment_status' );
if ( $default_comment_status == 'closed' )
{
remove_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 50 );
// optional solution using the WP_Admin_Bar class from /wp-includes/class-wp-admin-bar.php
# global $wp_admin_bar;
# $wp_admin_bar->remove_menu( 'comments' );
}
else
{
return;
}
}
Comments
Post a Comment