Skip to content

Instantly share code, notes, and snippets.

@dancameron
Created January 12, 2015 18:12
Show Gist options
  • Save dancameron/174631fedc27a61e07d1 to your computer and use it in GitHub Desktop.
Save dancameron/174631fedc27a61e07d1 to your computer and use it in GitHub Desktop.
Redirect Away if not logged in
<?php
function si_redirect_if_not_logged_in() {
if ( !is_user_logged_in() ) {
wp_redirect( home_url() );
exit();
}
}
add_action( 'pre_si_invoice_view', 'si_redirect_if_not_logged_in' );
add_action( 'pre_si_estimate_view', 'si_redirect_if_not_logged_in' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment