How to exclude some post from admin edit screen

Question

I want to restrict which post appears in a user edit screen based on its role. The roles are mapped to category.

  1. I am trying to add some conditions at the time posts are retrieved so that only posts belonging to a specific category are shown in the edit screen.

  2. I am not able to find out the appropriate hook to fire. I tried ‘pre_get_posts’ and then try to modify the query which satisfies the condition
    if (is_admin() && $query->is_main_query()) {
    but to no use.

0
Maanas Royy 2 months 0 Answers 11 views 0

Leave an answer