"Edit with Elementor" in the Admin Bar for Administrators Only
Hides the "Edit with Elementor" menu in the admin bar from everyone except administrators, so editors and shop managers are not tempted to change designed layouts.
Opens WPIDE on
Code
// Who keeps the admin bar link.
$wpide_el_bar_capability = 'manage_options';
add_action( 'admin_bar_menu', function ( $wp_admin_bar ) use ( $wpide_el_bar_capability ) {
if ( current_user_can( $wpide_el_bar_capability ) ) {
return;
}
$wp_admin_bar->remove_node( 'elementor_edit_page' );
}, 999 );
Notes
Change manage_options to another capability to keep the link for more roles.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.