Viewing 2 replies - 1 through 2 (of 2 total)
  • 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.

    Thread Starter Jacob N. Breetvelt

    (@opajaap)

    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

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Bug in home_url()’ is closed to new replies.