Adding Capabilities to Roles in WordPress via Hook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This gist is for my article at https://brettwidmann.com/extending-role-capabilities-in-wordpress/