I am using WP3 and want to starting adding users (many users to a single blog) but when I give a new user an account, they can see all the posts in the admin including scheduled, drafts, pending review etc. I either need the users to ONLY view their own posts or only view their own published posts (but not scheduled, drafts, etc). The admin should be able to see everything.

Here is a link I found on this issue with a code but the code is not working in my functions.php

http://wordpress.org/support/topic/show-only-authors-posts-in-admin-panel-instead-of-all-posts

link|improve this question
feedback

3 Answers

Put this into your functions.php file in your theme folder...

function query_set_only_author( $wp_query ) {
    global $current_user;
    if ( is_admin() && !current_user_can('manage_options') ) {
        $wp_query->set( 'author', $current_user->ID );
    }
}
add_action('pre_get_posts', 'query_set_only_author' );
link|improve this answer
Great snippet, btw how can this be done only for custom post type? – Mamaduka Jul 1 '11 at 14:03
feedback

I host a website with ~200 users (chelseadegreeshow.org/2011), and this was really important to me - seeing all the posts (even if unable to edit them) simply confuses the users. I added the function, and so far it looks perfect. I'm running WP3.1.2. So thank you!

link|improve this answer
feedback

Have a look here for a more complete solution (fixes the post count on the filter bar): Help to optimize some working code (to only show posts of logged in Author and fix post count)

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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