The following snippet can be used to show content only to users who are currently logged in.

if ( is_user_logged_in() ) {?>
   This will be shown to logged in users only
<?php } ?>
<?php if ( is_user_logged_in() ) { ?>
    Viewable by anyone who is logged in
<?php } else { ?>
    Viewable by site guests who are not logged in.
<?php } ?>
<?php if(current_user_can('administrator') ) {  ?>
   Only can be viewed by admins that are logged in
<?php } ?>

Leave a Reply

Get in Touch

Please fill out the form below and we will get back to you ASAP

  • This field is for validation purposes and should be left unchanged.