HydraDealer Login

add_action(‘template_redirect’, ‘redirect_logged_out_dealers’);

function redirect_logged_out_dealers() {
// Check if the user is visiting the specific dealer page
if ( is_page(‘hydradealer-info’) ) {

// If they are not logged in, force the redirect
if ( ! is_user_logged_in() ) {

// Define the destination URL after successful login
$redirect_to = ‘https://hydramaster.com/hydradealer-info/’;

// Generate the secure WordPress login URL with the redirect parameter
$login_url = wp_login_url( $redirect_to );

// Send the user to the login page
wp_redirect( $login_url );
exit;
}
}
}