Last active
April 19, 2016 10:41
-
-
Save marushu/69b017f446f7df2c6a54f00e8f334ca7 to your computer and use it in GitHub Desktop.
This file contains 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 | |
add_filter( 'wp', 'only_login_user', 0 ); | |
function only_login_user( $content ) { | |
global $post; | |
$post_type = 'post_type'; | |
$taxonomy = $taxonomy; | |
if( ! is_admin() && ( get_post_type() === $post_type || is_tax( $taxonomy ) ) | |
&& ! is_user_logged_in() ) { | |
wp_redirect( get_home_url() ); | |
exit; | |
} | |
return $content; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment