Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function my_filter( $content ) {
- $categories = array(
- 'news',
- 'opinions',
- 'sports',
- );
- if ( is_category( $categories ) ) {
- if ( is_logged_in() ) {
- return $content;
- } else {
- $content = '<p>Sorry, this post is only available to members</p>';
- return $content;
- }
- } else {
- return $content;
- }
- }
- add_filter( 'the_content', 'my_filter' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement