Hide pages specific user can’t edit

Question

I am using roles to allow specific users to edit pages. When a user is logged in and clicks the pages menu they are only allowed to edit those specified by their role. However, all of the pages on the site are displayed (including those they can’t edit). I would like to hide all pages that the specific user can’t edit so only the pages they are allowed to edit are displayed.
I found a way to do it in the functions file by assigning page ids to specific roles but this would require constant updating. (We are a non-profit where roles change regularly and pages may be reassigned to different roles.)

if($roles=='administrator'){
 $args=array('21','22','23');
}

Since WordPress knows which pages a user can edit, it should be easy enough to display only those pages on the list, but I can’t figure it out. I’d appreciate any help.

0
Tomcatt 1 month 0 Answers 10 views 0

Leave an answer