X

Only Show the Authors Posts in the Edit List

Snippets by IsItWP

If you’ve multiple authors writing posts for your blogs, you may want each author to only view their own posts in the edit list. By default, it’ll display all the posts to everyone.

Instructions: Add the following code to the functions.php file of your WordPress theme to only show the authors posts in the edit list.

<?php

function mypo_parse_query_useronly( $wp_query ) {
    if ( strpos( $_SERVER[ 'REQUEST_URI' ], '/wp-admin/edit.php' ) !== false ) {
        if ( !current_user_can( 'level_10' ) ) {
            global $current_user;
            $wp_query->set( 'author', $current_user->id );
        }
    }
}

add_filter('parse_query', 'mypo_parse_query_useronly' );

?>

You may also enjoy displaying comments in admin to authors own posts only.

Comments   Leave a Reply

  1. $current_user->id is DEPRECATED. Use…
    $current_user->ID

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!