can you try this snippet?
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 );
As for where to paste this : http://wp-events-plugin.com/tutorials/how-to-safely-add-php-code-to-wordpress/
Thread Starter
Anton
(@nat0n)
Thanks, but that didn’t seem to do the trick :/ I deleted (WP Super Cache) cache and reloaded couple of times but still see all links (here btw: https://omställning.net/evenemang/) turn up with HTTPS, where I want only some of them (the “root” links) to do so.
Not tested, but I think you’d need to modify Angelo’s code a little to check against network_site_url() for the site currently being viewed.
Something like this:
function my_em_force_ssl( $template ){
if( !is_ssl() && em_is_event_page() && network_site_url() == 'whatever.com'){
wp_redirect(str_replace('http:','https:', get_permalink()));
die();
}
return $template;
}
add_filter('template_redirect', 'my_em_force_ssl', 10 );
Thread Starter
Anton
(@nat0n)
Sorry, not that either. Even changing the is_ssl() to being non-negative doesn’t seem to make any difference – always http:// on all links.. Maybe the HTTPS plugin is too aggressive..?
It sounds like the snippet is being ignored or overwritten. It would be worth experimenting with different values for the 10 part to change priority.
Otherwise, I’d suggested checking with the support for that plugin to see what suggestions they have.
Thread Starter
Anton
(@nat0n)
I must be terrible at both explaining problems and reading through proposals for fixes.. This is what fixed it for me:
if( is_ssl() && em_is_events_page() ){
Missed both the events and the !is_ssl thingie, sorry about that. Glad you got me on the right track though, couldn’t have guessed/found what filter to use without your help.
glad you already sorted this out.