Skip to content

Instantly share code, notes, and snippets.

@noeltock
Last active April 28, 2020 11:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save noeltock/8473325 to your computer and use it in GitHub Desktop.
Save noeltock/8473325 to your computer and use it in GitHub Desktop.
<?php
function change_author_capabilities() {
$role = get_role( 'author' ) ;
$role->remove_cap( 'edit_published_posts' );
$role->remove_cap( 'publish_posts' );
$role->remove_cap( 'delete_published_posts' );
$role->remove_cap( 'edit_posts' );
$role->remove_cap( 'delete_posts' );
$role->add_cap( 'upload_files' );
$role->add_cap( 'edit_pages' );
$role->add_cap( 'edit_others_pages' );
$role->add_cap( 'edit_published_pages' );
}
add_action( 'admin_init', 'change_author_capabilities' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment