to show content only for log-in users in wordpress


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?php
  2.  
  3. if ( is_user_logged_in() ) {
  4.  
  5. ?>
  6.  
  7. //Logged in user stuff here...
  8.  
  9. <?php } else { ?>
  10.  
  11. <h3>You have to be a registered user to view this page</h3>
  12.  
  13. <?php } ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.