Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

3 Answers 3

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' );
share|improve this answer
    
Great snippet, btw how can this be done only for custom post type? –  Mamaduka Jul 1 '11 at 14:03
add comment

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)

share|improve this answer
add comment

I am also interested in finding a similar solution - but to also allow any co-author to view & edit the post.

The above code works great for single authors, but I use the co-author plugin which allows for nominating several authors to the same post (http://wordpress.org/extend/plugins/co-authors-plus/.

In this regard, it seems only the primary author can see the post - How can I allow all nominated co-authors to see the post also ?

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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