How can you disable the "quick edit" link in posts in WP dashboard for roles with following conditions:

  • The "Delete" ability shall stay
  • the "View" post ability shall stay
  • The "Edit" ability shall be removed

I tried this code in functions.php:

if ( current_user_can( 'manage_options' ) ) {
else {
    add_filter( 'post_row_actions', 'remove_quick_edit', 10, 1 );

But this code prevents you also from deleting the post. The DELETE link (delete to wastebasket) shall be preserved.

Then, I tried this code in functions.php:

function remove_quick_edit( $actions ) {
    unset( $actions['inline hide-if-no-js'] );
    return $actions;
if ( ! current_user_can( 'manage_options' ) ) {
    add_filter( 'post_row_actions', 'remove_quick_edit', 10, 1 );

But this code enables the EDIT link.

I refer to this post: Disable "quick edit" only for non admin in functions.php

1 Answer 1


I hope you need to disable "Edit" and "Quick Edit" for non-admin roles. So you can modify your code as follows

function remove_quick_edit( $actions ) {
    unset($actions['inline hide-if-no-js']);
    return $actions;
if ( ! current_user_can('manage_options') ) {
  • you are great! That's exactly what I wanted. It works perfectly fine.
    – vallespir
    Feb 5 at 13:14
  • @vallespir. If this answers your question, please consider marking it as the correct answer. It will helps others find it as resolved.
    – Irfan
    Feb 5 at 13:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.