this may be called as a bug in get_permalink
, but it may not be.
I had the same case, and when I tried to echo site_url();
I get the https://…
But once I updated the options for siteurl
and home
to have https
get_option( 'siteurl' );
get_option( 'home' );
get_permalink
worked fine.
I noticed that on multisite.