Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. function my_filter( $content ) {
  2.  
  3. $categories = array(
  4. 'news',
  5. 'opinions',
  6. 'sports',
  7. );
  8.  
  9. if ( is_category( $categories ) ) {
  10. if ( is_logged_in() ) {
  11. return $content;
  12. } else {
  13. $content = '<p>Sorry, this post is only available to members</p>';
  14. return $content;
  15. }
  16. } else {
  17. return $content;
  18. }
  19. }
  20. add_filter( 'the_content', 'my_filter' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement