How can I restrict editing of a page from backend only to a specific user?
I tried a few plugins but I thought doing it without plugins would be the way to go for me.
What measures I can take to solve this?
How can I restrict editing of a page from backend only to a specific user?
I tried a few plugins but I thought doing it without plugins would be the way to go for me.
What measures I can take to solve this?
You must be logged in to post a comment.
This can be done in two steps. First, add a hook to the page
/wp-admin/edit.php?post_type=page
to remove the desired page from appearing to other users. And another hook to redirect non-authorized users from trying to access the page directly/wp-admin/post.php?post=ID&action=edit
.Here, the post type is
page
, but it can be changed to any other. Make the adjustments indicated in the comments:Relevant Q&A’s:
– Where to put my code: plugin or functions.php?
– Update post counts (published, draft, unattached) in admin interface