Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save MichaelConte/8d7af556a961cf6e75c9ed895ef36902 to your computer and use it in GitHub Desktop.
Save MichaelConte/8d7af556a961cf6e75c9ed895ef36902 to your computer and use it in GitHub Desktop.
Hide private content from non users with PHP Code snippet, You can restrict non members to see any of your private content.
[php]
function member( $atts, $content = null ) {
if ( is_user_logged_in() && !is_null( $content ) && !is_feed() ) {
return $content;
return ”;
} else {
$yonlendir = get_permalink();
$form = wp_login_form(array(‘echo’ => false, ‘redirect’ => $yonlendir ));
return $form;
}
}
add_shortcode( ‘mem’, ‘member’ );
[/php]
@MichaelConte
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment