5

i want to remove the comment review icon from the wp-admin bar and change the profile settings in wp-admin.

enter image description here

  • i searched on internet for this ....but could not find any guide – Shahrukh Khan Feb 19 '15 at 15:32
  • Please post what you have searched for in your question. It may be that you don't know the proper termonology to search for, and someone can point you in the right direction. But as it stands, this question looks like you are saying "someone do this for me", and that is not what this site is about. I again ask you to please vist How do I ask a good question?. – David Gard Feb 19 '15 at 15:33
8

To remove the comments menu from the top admin bar you can use the $wp_admin_bar global and the remove_menu() method like this:

function my_admin_bar_render() {
    global $wp_admin_bar;
    $wp_admin_bar->remove_menu('comments');
}
add_action( 'wp_before_admin_bar_render', 'my_admin_bar_render' );

As for changing the icon on the settings section of the left admin menu, you can modify the dashicon that is used with another. This is an example of how to change it to a globe:

function modify_settings_icon() {
    global $menu;
    $menu[80][6] = 'dashicons-admin-site';
}
add_action( 'admin_menu', 'modify_settings_icon' );

If the last snippet doesn't work for you, just confirm the order of your menu items by debugging the global $menu array, identify the index of the Settings menu item, and modify it to your liking.

If you need to use a custom icon that isn't in the dashicons set that ships with WordPress, you should be able to change the code above to something like $menu[80][6] = 'your-custom-icon-class'; and then add some css to add your image on that custom class.

  • the last one did not work – Shahrukh Khan Feb 20 '15 at 5:06
  • how should i debug the $menu array – Shahrukh Khan Feb 20 '15 at 5:06
  • 2
    You need some basic understanding of PHP to debug. For example: echo '<pre>'; print_r( $menu ); echo '</pre>'; This will print out the menu array so you can find the index of the Settings menu. Then the number 80 above will change to the index of your Settings menu. – jphase Feb 20 '15 at 14:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.