Remove Quick Edit for Non-Administrators
Hides the Quick Edit link and the Edit bulk action for everyone except administrators, so status, dates and slugs are only changed in the full editor.
Opens WPIDE on
Code
$wpide_remove_quick_edit = function ( $actions ) {
if ( ! current_user_can( 'manage_options' ) ) {
unset( $actions['inline hide-if-no-js'] );
}
return $actions;
};
add_filter( 'post_row_actions', $wpide_remove_quick_edit, 20 );
add_filter( 'page_row_actions', $wpide_remove_quick_edit, 20 );
add_action( 'admin_init', function () {
if ( current_user_can( 'manage_options' ) ) {
return;
}
foreach ( get_post_types( array( 'show_ui' => true ) ) as $post_type ) {
add_filter( "bulk_actions-edit-{$post_type}", function ( $actions ) {
unset( $actions['edit'] );
return $actions;
} );
}
} );
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.