Skip to content

Instantly share code, notes, and snippets.

@goatboy91587
Created June 9, 2019 21:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goatboy91587/ae888f901ec8110c11680935437a2b34 to your computer and use it in GitHub Desktop.
Save goatboy91587/ae888f901ec8110c11680935437a2b34 to your computer and use it in GitHub Desktop.
Adding Capabilities to Roles in WordPress via Hook
// Make private posts and pages available to subscribers
function subs_read_private_content(){
$subRole = get_role( 'subscriber' );
$subRole->add_cap( 'read_private_posts' );
$subRole->add_cap( 'read_private_pages' );
}
add_action( 'init', 'subs_read_private_content' );
@goatboy91587
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment