Hide "Edit with Elementor" Links From Non-Administrators
Removes the "Edit with Elementor" links under post titles in admin lists and the "Edit with Elementor" button in the editor for users who are not administrators. They can still edit text in the regular editor.
Opens WPIDE on
Code
// Users with this capability keep the link.
$wpide_el_row_capability = 'manage_options';
$wpide_el_row_links = function ( $actions ) use ( $wpide_el_row_capability ) {
if ( ! current_user_can( $wpide_el_row_capability ) ) {
unset( $actions['edit_with_elementor'] );
}
return $actions;
};
add_filter( 'post_row_actions', $wpide_el_row_links, 20 );
add_filter( 'page_row_actions', $wpide_el_row_links, 20 );
// Also hide the "Edit with Elementor" button in the block and classic editors.
add_action( 'admin_head', function () use ( $wpide_el_row_capability ) {
if ( ! current_user_can( $wpide_el_row_capability ) ) {
echo '<style>#elementor-switch-mode,#elementor-editor,#elementor-go-to-edit-page-link{display:none!important;}</style>';
}
} );
Notes
Pair it with "Block Roles From the Elementor Editor" to stop access completely, not just hide the link.
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.