Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jeff Farthing

    (@jfarthing84)

    if ( ! is_user_logged_in() ) {
        $redirect_to = wp_login_url();
        redirect( $redirect_to );
        exit;
    }
    Thread Starter ashf

    (@ashf)

    Thank you.
    Is that the code to insert to template files?
    I prefer to use a hook.

    How about this?

    function my_wc_loginpage(){
      if(!is_user_logged_in() && (is_account_page() || is_checkout())){
        $redirect_to = wp_login_url(); wp_redirect( $redirect_to ); exit;
      }
    }
    add_action('template_redirect','my_wc_loginpage');

    It’s nice if ThemeMyLogin have this ability by default.

    Plugin Author Jeff Farthing

    (@jfarthing84)

    That will work!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Woocommerce login’ is closed to new replies.