Tag Archives: pre_get_post

[Snippet] WordPress: Hide Post By Author From Admin Post List

There is a situation where we need to hide a post written by user A from user B while both of them has same role as “Editor”.

Let’s say we have two user as follow:

UserA with ID 17 and roles Editor
UserB with ID 9 and roles Editor

We need to hide all post by UserB so UserA cannot see it in WordPress Post List (admin page).

Code snippet below may help you to do this in easily.

Modified as you want 😀