0

How do I find out the correct hooks that are being used when installed plugins and themes insert their own menus into the WordPress admin top menu bar?

I know how to remove them from the admin sidebar from the following the instructions in the following post

How to remove admin menu pages inserted by plugins?

but it doesn't explain how to find the ones when they're inserted into the top admin bar. I'm specifically wanting to remove the Avada link from the top admin menu bar if anyone can help.

3 Answers 3

1

You can play around the WP_Admin_Bar class

add_action( 'admin_bar_menu', 'modify_admin_bar' );

function modify_admin_bar( $wp_admin_bar ){
 // do something with $wp_admin_bar;
 $wp_admin_bar->get_nodes();

}

Have look to the codex WP_Admin_Bar to see all methods available.

0
0

To be more specific than @Benoti, you need to use the remove_node function from the WP_Admin_Bar class. It is clearly explained in the codex, including how to find the id of the node you want to remove. Specifically, to remove the Avada menu you need to create a child theme of Avada with a functions.php file containing the following code:

add_action( 'admin_bar_menu', 'remove_avada_from_admin_bar', 999 );

function remove_avada_from_admin_bar( $wp_admin_bar ) {
    $wp_admin_bar->remove_node( 'wp-admin-bar-avada' );
}
0
0

Try use wp_before_admin_bar_render.

add_action( 'wp_before_admin_bar_render', 'modify_admin_bar' );
1
  • How should it help? What is modify_admin_bar function? Commented Sep 24, 2018 at 6:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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