Remove “Edit With Elementor” from adminbar
-
Hi Elementor friends!
We have a client issue where we want Editors to be able to use Elementor on any page on the site except the homepage.
We had created a function that up until recently worked fine. The only issue we have right now is that the code that previously removed the “Edit with Elementor” from the frontend adminbar no longer works.
I think Elementor (in a recent update) now adds the menu items after the adminbar renders with javascript so
remove_menuno longer seems to work (though continues to work fine removing other non-Elementor menu items)? Any ideas on how to hide it? This is a client requirement for usThanks much for your assistance.
This is the function we created that removed both the “Edit Page” link and the “Edit with Elementor” link from the admin bar. It still correctly removes “Edit Page”, but “Edit with Elementor” is no longer is removed. I also tried remove_node with no luck.
add_action( 'wp_before_admin_bar_render', 'binaryfork_before_admin_bar_render', 999 ); function binaryfork_before_admin_bar_render() { global $wp_admin_bar; $user = wp_get_current_user(); $roles = ( array ) $user->roles; if( is_user_logged_in() && !empty($roles[0])) { if ($roles[0] == "editor") { if( is_front_page() ) { $wp_admin_bar->remove_menu('elementor_edit_page'); $wp_admin_bar->remove_menu('edit'); } } } }
The topic ‘Remove “Edit With Elementor” from adminbar’ is closed to new replies.