I am working on a travelling site and planning to add following feature to the portal.

  1. User Registration capability.
  2. Let user manage there profile
  3. Let user submit there travel story for approval.
  4. Let them edit/modify their posts
  5. Provide some other theme/color to the user in dashboard.

I have already gone through WordPress Roles_and_Capabilities and seems like it will be able to do most of the work for me. Additionally it seems that Contributor role will help me to achieve all of the above mentioned goals except mentioned at level 5.

I tested Contributor role, but finding one issue with it, logged in user able to see all posts in dashboard (Though can not modify them except his/her own). I only want to show current user the posts he has submitted if he/she has been assigned Role as Contributor.

I am aware that i can use remove_cap('capability to remove') and add_cap(''); mehods to remove/add capabilities.

Is there any way to extend the Contributor role and add capability to show only user created posts.

Additionally is it possible to change dashboard theme for all users who have role below admin or editor?

as a side note, I am not developing any plugin.


The following excludes posts not written by the user from the edit-post screen (you can add further screen IDs if necessary) if they have the 'contributor' role.

Normally I would suggest adding a custom capability, and comparing the capability not the role. But since it seems this plug-in isn't for distribution, this is isn't such an important distinction.

add_action( 'pre_get_posts', 'wpse111322_hide_posts_not_by_me' );
function wpse111322_hide_posts_not_by_me( $query ){

    global $wp_roles;

    //Which screen IDs to apply to:
    $screen_ids = array( 'edit-post' );

    if( $query->is_main_query() && is_admin() && in_array( get_current_screen()->id, $screen_ids ) ){

        //Get the user's role
        $current_user = wp_get_current_user();
        $roles = $current_user->roles;
        $role = array_shift( $roles );

        if( $role == 'contributor' )
            $query->set( 'author', get_current_user_id() );

Note: This doesn't remove the post count. So you may see All(61) at the top but only 5 posts in the table.

  • thanks for the input and i am also in support to create custom capabilities, my intention was like to inherit all capabilities what contributor have and add additional as per requirement – Umesh Awasthi Aug 23 '13 at 11:39

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.