Remove “Edit with Elementor” on admin bar for certain roles
-
My question goes beyond the basic role manager capability. I generally use the Adminimize plugin to hide certain menu items from the admin bar. But in this case, the “Edit with Elementor” menu doesn’t appear in Adminimize.
I want to hide the menu and dropdown from specific roles that will have Elementor editing capability. However, I don’t want the user to be able to edit the headers, footers, theme files, and my Crocoblock JetEngine listings, etc.
I found this code that works to hide the menu from the editor role. I want to add additional roles. I tried adding them in but it only works for one role at a time. Can anyone suggest the best way to do this?
// hide edit with elementor for editor role add_action('wp_head', 'allteams_custom_styles', 100); function allteams_custom_styles() { $user = wp_get_current_user(); if ( in_array( 'editor', (array) $user->roles ) && !is_admin() ) { echo "<style>#wp-admin-bar-elementor_edit_page{display: none !important;}</style>"; } }
- The topic ‘Remove “Edit with Elementor” on admin bar for certain roles’ is closed to new replies.