为您的自定义角色提供“read\\u member\\u posts”或其他功能。然后可以对\\u content()应用筛选器
add_filter( \'the_content\', \'my_wpse20347_filter\' );
function my_wpse20347_filter( $content )
{
global $post;
if( author_can( $post->ID, \'edit_posts\' ) || current_user_can( \'read_member_posts\' ) )
{
return $content;
}
else
{ // Everyone else sees this in place of the content.
return \'<p>Only members may view this post</p>\';
}
}