How to disable page delete

My client is not a computer person. I created a website for him. There is some important pages. My client is always delete this page. Then i want to reconfigure the code (the page id).

How do i disable delete options for particular pages.

PS: He may able to EDIT these page. Not Delete.

6 s
6

You can remove the capabilites delete_pages, delete_others_pages and delete_published_pages from the role which the user is assigned to. This will prevent the complete user role from deleting pages.

To restrict this behavior only to one user, you have to create and assign a dedicated, new role to the user. Look at the Members plugin from Justin Tadlock for more information.

Example: Remove the ability to delete pages from admin role

$role = get_role('administrator');
$role->remove_cap('delete_pages');
$role->remove_cap('delete_others_pages');
$role->remove_cap('delete_published_pages');

More resources

  • Codex: Roles &
    Capabilities
  • Codex: get_role()

Leave a Comment