Show Only Author Posts In Admin Panel For Logged In Users

For a logged in users can see only the posts the authors done on the blog or website. This can be done dynamically in wordpress. Open your functions.php page and paste the code given below on a <?php ?> code tag.

<?php
function posts_for_current_author($query) {
global $user_level;

if($query->is_admin && $user_level < 5) { global $user_ID; $query->set(‘author’, $user_ID);
unset($user_ID);
}
unset($user_level);

return $query;
}
add_filter(‘pre_get_posts’, ‘posts_for_current_author’);

?>