Below is the code to make private posts visible to subscribers in WordPress.
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
<?php | |
//* Make private posts visible to subscribers | |
function customprefix_private_posts_subscribers() { | |
$subRole = get_role( 'subscriber' ); | |
$subRole->add_cap( 'read_private_posts' ); | |
} | |
add_action( 'init', 'customprefix_private_posts_subscribers' ); |
Alternatively, you can download, install and set up Members from the WordPress Plugin Repository.