I need to show only the author’s posts in the Edit list in WordPress, (excluding Media attachments).

I’m starting with this code:

/**
 * limit post display to post authors (excludes admins)
*/
function shapeSpace_set_only_author($query) {
    global $current_user;
    if (!current_user_can('edit_others_posts')) {
        $query->set('author', $current_user->ID);
    }
}
add_action('pre_get_posts', 'shapeSpace_set_only_author');

But because I’m using Co-Authors Plus plugin, the code display only post of the first Co-Authors Plus list, how to extend to all the Co-Authors Plus list?

Thanks!

Read more here: Show Only the Author’s Posts in the Edit List


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: