How to remove quick edit button in WordPress

If you want to hide the quick edit button in WordPress backend, for non-admin, add this code to your plugin or function file:

<?php
// remove quick edit button if not admin
add_action('init','wpster_remove_quick_edit');
function wpster_remove_quick_edit(){
  $current_user = wp_get_current_user();
	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);
	}
}
function remove_quick_edit( $actions ) {
	unset($actions['inline hide-if-no-js']);
	return $actions;
}?>

Submit a Comment

Your email address will not be published. Required fields are marked *