You can set the default comment status to ‘closed’, but the comments link will stay. Simply drop the following into your functions.php file to get rid of it based on the condition. Offers 2 different approaches.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /** * 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; } } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.