I am using some code to restrict the author to only see their own post.
I've disabled this but still can't see the post with the 2nd author.
This is the code I am using to restrict users to their posts.
I am pretty certain this is the culprit as when I disable this, I can see all posts and edit the co-author post.
So the question is - how to edit this to work with multiple-authors?
function posts_for_current_author($query) {
global $pagenow;
if( 'edit.php' != $pagenow || !$query->is_admin )
return $query;
if( !current_user_can( 'manage_links' ) ) {
global $user_ID;
$query->set('author', $user_ID );
}
return $query;
}
add_filter('pre_get_posts', 'posts_for_current_author');
In the above code, I also tried with commenting out
// if( !current_user_can( 'manage_links' ) ) {
But this still had no effect.
Only commenting out the entire code above worked.
I was then able to login as the second Author, see the post and edit it.
However, I need to use this code to restrict the author to see only their own post (there are many authors and many posts and the authors are newbies so this is attempting to keep things easy for them when they log in) - so how to make it recognise multiple authors?