View role-extender.php
<?php | |
/** | |
* Plugin Name: Allow Subscribers to Read Private Content | |
* Plugin URI: https://brettwidmann.com | |
* Description: A plugin that allows subscribers to read private posts and pages | |
* Version: 1.0 | |
* Author: Brett Widmann | |
* Author URI: https://brettwidmann.com | |
*/ |
View add-cap-functions.php
// 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' ); |