show current authors post in wordpress admin panel

When you logged in to wordpress panel that time show only current authors post in wordpress admin panel. I got requirement to show only current users post in admin panel. Because is there are lot of users in wordpress then you need search for your posts.

show current authors post in wordpress admin panel

You just need to open the functions.php file from your wordpress theme folder and put following code in that file.


function posts_for_current_author($query) {
 global $pagenow;

 if( 'edit.php' != $pagenow || !$query->is_admin )
 return $query;

 if( !current_user_can( 'manage_options' ) ) {
 global $user_ID;
 $query->set('author', $user_ID );
 }
 return $query;
}
add_filter('pre_get_posts', 'posts_for_current_author');

show current authors post in wordpress admin panel
show current authors post in wordpress admin panel

Note: If you are wordpress developer then only use this step or you can ask to do changes to any wordpress developer. If you face any issue then please write to me on wordpressapi@gmail.com. This article is written by purabtech.in.