0

So I've been tinkering with the admin roles and I can't seem to be able to revoke create page rights for the admin. I can only find 'Edit page'.

If I remove Edit page, the entire pages tab goes away(probably because of not enough rights)..

Is there a way to disable creating/deleting pages and keep the pages tab?

I have this so far.

$role = get_role('administrator');
$role->remove_cap('delete_pages');
$role->remove_cap('delete_others_pages');
$role->remove_cap('delete_published_pages');
$role->remove_cap('publish_pages');
  • what is your code and what you need to achieve by keep the pages tab if it is not used? – Jevuska Apr 26 '16 at 10:37
  • The admin can edit that page if needed. But I don't want him to create/delete. – Evergetic Apr 26 '16 at 14:41
0

If achieving this with a plugin is acceptable to you, an answer to a similar question recommended the Advanced Access Manager plugin.

  • I would rather do it myself unless there is no other option. But thank you for the plugin, if I can't find out how to do it i'll just use it! – Evergetic Apr 26 '16 at 22:08
0

By removing the capability of deleting published pages and publishing pages, I have effectively stopped the admin from creating or deleting anything that is on the website.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.