I want to redirect the user after logging in to the main page, but only if it is on page X. This is because some pages are protected with a password.
My code:
add_filter('woocommerce_login_redirect', 'redirecionar');
function redirecionar() {
$redirect = 'https://paginaweb.pt';
return $redirect;
}