Created
March 5, 2019 05:44
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From Downgraf - Hide Private Content From Non Users With PHP Code Snippet