Last active
December 9, 2020 15:11
-
-
Save yousufansa/461fc3ec9e0902532dd6539685188a10 to your computer and use it in GitHub Desktop.
Jobhunt - Redirect Non Logged in User From WC Account Page to Jobhunt Register/Login Page
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
if ( ! function_exists( 'jh_child_wc_account_redirect_non_logged_user_to_login_jobhunt_login_form' ) ) { | |
function jh_child_wc_account_redirect_non_logged_user_to_login_jobhunt_login_form() { | |
if ( ! is_user_logged_in() && ( ( is_account_page() && ! is_lost_password_page() ) || ( function_exists( 'jh_wpjm_get_page_id' ) && is_page( jh_wpjm_get_page_id( 'jobs-dashboard' ) ) ) ) ) { | |
$register_login_page = jobhunt_submit_job_form_login_url( get_permalink( get_option('woocommerce_myaccount_page_id') ) ); | |
wp_redirect( $register_login_page ); | |
exit(); | |
} | |
} | |
} | |
add_action( 'template_redirect', 'jh_child_wc_account_redirect_non_logged_user_to_login_jobhunt_login_form' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment