add_cap for author role in a Plugin – is this correct code?
-
Hello
I wrote a little “plugin” for enhancing the user role “author”. He should be able to
– see pages in admin area
– edit pages which are published by himself
– publish pages (authors normally are only allowed to publish posts)With these short lines of codes I got success and it works, but I’m not a developer and I’m not sure, if this is a real good solution. May please somebody tell me, if the following code ist correct for putting it into a plugin? Thanks a lot in advance.
<?php
$role_object = get_role( ‘author’ );
$role_object->add_cap( ‘edit_pages’ );
$role_object->add_cap( ‘publish_pages’ );
$role_object->add_cap( ‘edit_published_pages’ );
?>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘add_cap for author role in a Plugin – is this correct code?’ is closed to new replies.