Created
October 9, 2017 14:35
-
-
Save growdev/f7bdbfced6989638654fa11d0a2833d1 to your computer and use it in GitHub Desktop.
redirect from course page if not logged in
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 | |
function convertkit_page_template_redirect() | |
{ | |
if( is_page( 'elements-one' ) && ! is_user_logged_in() ) | |
{ | |
$location = get_site_url() . '/courses/login/?redirect=' . get_permalink( $post->ID ); | |
wp_redirect( $location ); | |
die; | |
} | |
} | |
add_action( 'template_redirect', 'convertkit_page_template_redirect' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment