Skip to content

Instantly share code, notes, and snippets.

@FrancoStino
Created January 4, 2023 11:52
Show Gist options
  • Save FrancoStino/282c321d8e39c1f747183ea46f2dbae5 to your computer and use it in GitHub Desktop.
Save FrancoStino/282c321d8e39c1f747183ea46f2dbae5 to your computer and use it in GitHub Desktop.
Force Login Gestionale Woocommerce
<?php
function woo_login_redirect() {
if (! is_user_logged_in() && is_front_page() ) {
wp_redirect( wc_get_page_permalink( 'myaccount' ) );
exit;
}
}
add_action('template_redirect', 'woo_login_redirect');
//////////////////
add_filter('woocommerce_login_redirect', 'njengah_login_redirect_to_homepage');
function njengah_login_redirect_to_homepage($redirect_to) {
return home_url();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment