Customize Post Views

Depending on your role and capabilities, you may see something like this on your posts/pages screen “mine () | all () | published ()”

Those items are editable.

In my case, I wanted ‘authors’ to only have access to the ‘mine’ list, since ‘mine’ is default, I wanted to remove the views list entirely, but only for non-administrators.

add_filter('views_edit-post', 'only_show_mine');
function only_show_mine( $views ) {
    if (!current_user_can('promote_users')) {
        $views = array(); //remove all options
        //unset($views['all']);
        //unset($views['publish']);
    }
return $views;
}

Leave a Reply

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

%d bloggers like this: