0

I have this in my functions.php (child theme)

//Add capabilities to author, so he/she can edit...    
 function add_theme_caps() {
    // gets the author role
    $role = get_role( 'author' );
    $role->add_cap( 'edit_pages' );
    $role->add_cap( 'edit_published_pages' );
    $role->add_cap( 'edit_posts' ); 
    $role->add_cap( 'edit_others_posts' );  
    $role->add_cap( 'publish_posts' );  
    $role->add_cap( 'publish_pages' );  
    $role->add_cap( 'edit_published_posts' );   
    $role->add_cap( 'edit_published_pages' );       
}
add_action( 'admin_init', 'add_theme_caps');

but when I log in as an author the author is not able to edit pages (that admin has created) why? It's possible for the logged in author to view the pages, but not to edit and save anything.

2
  • Why not making the author an editor instead?
    – cablop
    Commented Feb 23, 2021 at 16:28
  • @cablop - I seriously don't remember :_) Commented Feb 24, 2021 at 9:12

1 Answer 1

1

It was a simple thing when thinking of it... I needed to add:

$role->add_cap( 'edit_others_pages ' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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