Check if WordPress User is Logged-In

Support
Topic WordPress
Access WP-Admin, FTP

Display different information for website visitors depending on whether or not they are logged in.

If you’re looking do show specific information for your WordPress website visitors based on whether or not they are logged in, there is an easy way to check for this.

<?php if ( is_user_logged_in() ) { ?>

<!-- Whatever you're trying to only show to logged in users -->

<?php } else { ?>

<!--  Whatever you're trying to show non-logged in users -->

<?php } ?>

It’s really that simple. This can be useful for showing things like member-specific information, advertisements to non-users, etc.

Questions or Comments

avatar
  Subscribe  
Notify of
Login
Resources
Status
Contact

Quick Open Ticket

You can quickly open a ticket without logging in. Be sure to use your login email address and include the web address of your service.