I’m using this code in functions.php to load https on my events-manager pages:
function my_em_force_ssl( $template ) {
if ( ! is_ssl() && em_is_event_page() ) {
wp_redirect( str_replace( 'http:', 'https:', get_permalink() ) );
die();
}
return $template;
}
add_filter( 'template_redirect', 'my_em_force_ssl', 10 );
Is there a way to unload or revert back to http when leaving those pages?
Not tested, but give it a shot:
And a heads up,
template_redirect
is an action, so no need to accept & pass back params 🙂