Give your custom roles the capability to “read_member_posts” or whatever. Then you could apply a filter to the_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>';
}
}
Related Posts:
- How to change the case of all post titles to “Title Case”
- How set featured posts using checkbox in post edit screen?
- Post/Page Preview Template
- Convert custom fields to post categories
- Display posts by tag on page
- How to batch update post content with custom post meta value
- Keep a fluid max number of posts on site
- multicheck box for post metabox
- Archived Posts in Wrong Category
- Get post embedded image caption
- Odd/even class on article tag
- Have save_post write to database image meta [closed]
- WordPress get posts by date without query_posts
- WP_Query only ONE post, won’t work
- Pagination not working on custom query
- Importing New Posts from Live Site into Local Dev Site
- PHP Notice error (when on 404 page)
- How to get posts by multiple post slugs? [duplicate]
- Changing next and previous post link text
- WordPress’ visual editor messing up my (nested) lists (and other things as well)
- Disabled wp-cron, set up system cron but still have missed schedule posts
- I would like to give special promotion for the first 100 posts in my blog? Can anyone tell me how to do that?
- Make view count for pop up post
- add_rewrite_rules for type of post
- Trigger a Link once a new post is Published
- Edit custom post type admin menu link
- Inserting custom data to the_post() during loop
- How can I get the media inside a post?
- Permission issue with custom post type – not added to menu – by plugin
- Get Page ID of blog homepage
- Get Image tag from content of post
- Visting slug for ‘post’ post type shows 404 not archive?
- Trying to alter the post_content through the_post
- Automatically create a new page daily with last three posts
- Add filter to the end of the post
- How to add a class to each individual post?
- Indirect modification of overloaded property WP_Post::$ancestors has no effect
- How do I change the location of post-specific information?
- ACF to select posts not displaying on blog page
- Benefits to using semantic HTML in post content? [closed]
- Check if current user has a post and that post has any term/s from a specific custom taxonomy outside the loop
- How can I insert a new markup element after 4 posts automatically? [closed]
- the_excerpt is displaying excerpts of every post
- How to remove “» (title of post or page)”?
- Extract wordpress posts content and category content
- Post: how to set created date after post has been published [closed]
- WordPress loop not working on static front page
- Sidebar on single.php not showing up
- remove all custom post created
- Multiple Blog Pages
- Hide content from Post Preview
- How to get the next and previous image title from attachment or gallery?
- Adding if statement into the_content()
- Pagination for posts inside a specific category
- Change modified date to current date when title updated automatically
- Creating a redirect option for current page url
- How to edit a custom theme?
- WordPress posts have a different URL to the index
- how to Update guid = “text”+post_name?
- SQL DELETE multiple post_meta on single and multi-sites
- How to put the author of the post in the comments?
- Blog posts pagination not working
- unable to write to the database while uploading images
- How to Best Create Separate Subscribers and User Experience
- Post not using taxonomy template
- query posts with selected post ids first
- How can I create a Survey Form in WordPress that users can fill in and then submit the entire survey contents as a post?
- How to display related post from same category in single.php
- Save All Post Permalink From A Specific Category into a .txt file
- How to get value of a selected option from select tag and use it in WP_query to filter posts?
- Using WP page password protection as defacto login
- get current index of post content in category page
- Permalink structure for two seperate blogs
- wp_query args with relation
- How do I apply a wordpress function to something with no ID inside an archive page?
- Add new post only in assigned category
- Creating Ordered Query using Meta_key
- WordPress each user has each content for a page,how to do that?
- How to change post template via url?
- How to remove related post from home page
- Is there a Standard Format for Clean URLs for Archives of Custom Posts?
- Send/Publish a Post front end
- How do I list categories and the common categories for posts beneath those categories?
- Post restoration
- Insert new post for each user infinite loop error
- Last three posts not being put in order by date. How to fix this?
- WordPress sub-posts and permalinks
- Assign a link of a post to that contains that post?
- wp_query posts sorting doesn’t work
- Show List of Posts With Comments Open
- When and how will php code in a user made WordPress page be executed?
- How to remove a date from wordpress post
- wordpress pinboard theme [closed]
- There is a page on my website that doesn’t show in the Pages section of WordPress [closed]
- Difficulty hiding a span per a body class within WordPress
- Onclick open posts displayed in slider in a popup [closed]
- Listing category and its posts one by one
- Adding contents to my wordpress site
- Can`t Access Post Page After Migration
- Moving featured image to top of new post editor screen