Hello @opajaap
What is your settings on wp-admin setting panel (clicking on Settings -> General) for WordPress Address (URL) and Site Address (URL)?
Add this code in functions.php
add_filter( 'home_url', 'add_home_url', 1000, 4 );
function add_home_url( $url, $path, $orig_scheme, $blog_id ) {
return str_replace( 'http://', 'https://', $url );
}
Hope this will help.
Thanks.
A workaround I did have already:
$my_url = home_url() . $my_stuff;
if ( is_ssl() ) {
$my_url = str_replace( 'http://', 'https://', $my_url );
}
Changing the general settings fixed it.
Would it not be better if home_url() checked is_ssl()?
One sets up the website, after that he gets an ssl certificate, but, like me, many will forget to change the general settings