WordPress page login protect

<?php if ( is_user_logged_in() ) { ?> <!-- 1. Use your content which you want to show for login user.--> <?php } else { ?> <!-- 2. Use your content which you want to show for un-login user. if you want user redirect iog-in Page use --> <a href="<?php bloginfo('home'); ?>/wp-login.php?action=regidter">hear</a> this code --> <?php } ?>
Documentation:

Follow comment inside of code
1. Use your content which you want to show for login user.
2. Use your content which you want to show for un-login user. if you want user redirect iog-in Page use

1 Response

But in which php file ??

Write a comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.