Hi Dandy,
Please try the following code. I have created role using WP Role Editor and test.
function buddydev_remove_unwanted_menu() { global $wp_admin_bar; $user = wp_get_current_user(); $remove = false; // teacher, principal your role id if ( in_array( 'teacher', (array) $user->roles ) ) { $remove = true; } elseif ( in_array( 'principal', (array) $user->roles ) ) { $remove = true; } if ( $remove ) { $node_ids = array( 'my-account-xprofile-edit', 'my-account-xprofile-change-avatar', 'my-account-xprofile-change-cover-image' ); foreach( $node_ids as $id ) { $wp_admin_bar->remove_node( $id ); } } } add_action( 'wp_before_admin_bar_render', 'buddydev_remove_unwanted_menu' );
Let me know if It is working for you or not.
Thank You
RaviHi, Ravi
Thank you very much for the continued update. It works perfectly as I expected.Thanks. I will mark it as resolved.
By the way, I submitted a plugin suggestion about couple of days ago about notification function. If you get time, could you view that suggestion and see whether it’s worth to create it?
Thank you very much.
- This reply was modified 8 years, 6 months ago by Dandy Jefferson.
You must be logged in to reply to this topic.
This topic is: resolved