Wordpress - Disable "quick edit" only for non admin in functions.php

Use current_user_can to wrap the add_filter call:

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

manage_options is an Admin capability. If the current user can do it, he's an admin (on a vanilla WP installation).

See:

http://codex.wordpress.org/Roles_and_Capabilities

and

http://codex.wordpress.org/Function_Reference/current_user_can


Here is the code if you wish to remove the Quick Edit option from Pages as well:

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

Tags:

Quick Edit