Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner Author

@goatboy91587 goatboy91587 commented Jun 10, 2019

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