If you running a multi author site, you will notice that all authors and contributors are able to see the posts from other users. Although they cannot edit or modify, but you may not want them to see the posts which are in review or in draft.

You can do this by installing third party WordPress plugin such as View Own Post Media Only. But for this little job, I personally do not recommend to use any plugins.

This little code hack will help you to limit your authors and contributors to their own posts in WordPress admin. Copy and past the following code in you function.php file.

if (current_user_can('contributor') || current_user_can('author')){
	add_filter('parse_query', 'filter_my_own_posts_query' );

function filter_my_own_posts_query( $wp_query ) {
    if ( strpos( $_SERVER[ 'REQUEST_URI' ], '/wp-admin/edit.php' ) !== false ) {
      global $current_user;
      $wp_query->set( 'author', $current_user->id );
This article is about: function.php, WordPress,


StackTips provides programming tutorials, how-to guides and code snippets on different programming languages. Follow us on Twitter


Please note: We reserve the right to delete comments that contains snarky remarks, offensive or off-topic. To know more read our comments policy.