WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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


share|improve this question

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

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

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

Your Answer


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.