Skip to content

Instantly share code, notes, and snippets.

@growdev
Created October 9, 2017 14:35
Show Gist options
  • Save growdev/f7bdbfced6989638654fa11d0a2833d1 to your computer and use it in GitHub Desktop.
Save growdev/f7bdbfced6989638654fa11d0a2833d1 to your computer and use it in GitHub Desktop.
redirect from course page if not logged in
<?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