Display only author posts in dashboard all posts panel
I would like to display only authors own posts in dashboard all posts section. As of now it displays everything.
I found some code here which is written by @t31os Its working correctly.
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');
But user_level is deprecated. So can anyone modify the code for new version? Thanks
Topic deprecation author Wordpress
Category Web