Halloween Sale 15% off Ends in See the plans
PHP

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.

Don’t have WPIDE yet? Install it on your site

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

  1. Install WPIDE on your WordPress site (it is free) and open Code Snippets.
  2. Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
  3. It is added inactive: review the code and settings, then switch it on.

Have a snippet worth sharing?

Publish it to the library from WPIDE or right here. Sign in with any WordPress site that runs WPIDE, free or Pro. Public snippets are reviewed by the WPIDE team before they appear.

Which site should get this snippet?

Enter the address of your WordPress site. WPIDE opens there in a new tab with the snippet ready to review and save.

Remembered in this browser only, so you are asked once.

Report this snippet

Tell the WPIDE team what is wrong: broken code, something harmful, spam or copied work.