0

I want that only Admin and Editor roles can use the 'Move to Trash' option in my blog, and other users will get the 'Move to Draft' option instead.

Like inside of the 'Quick Edit' / 'Bulk Actions' options in All posts of the Dashboard, and the Post editor side bar:

Admin post list

Post submit meta box

0

I believe you can add_filter for post_row_actions to filter out the ones you don't want, add in the functions you do want. Like so:

add_filter( 'post_row_actions', 'my_plugin_update_actions', 10, 2 );
function my_plugin_update_actions($actions, $post) {

    unset($actions['trash']);
    $actions['draft'] = '<a class="submitdelete" title="Move this item to drafts" href="'.admin_url('post.php?post='.$post->ID.'&action=draft').'">Move To Draft</a>';

    return $actions;

}

You would have to write a hook to handle the request and logic to only do this if capabilities aren't administrative but that should get you started in the right direction.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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