Make new subsites have https in url by default

When I add a new subsite it gets a domain "",

I want it to by default add it as "".

To be clear I am specifically trying to make the database options "siteurl" and "home" to be set to "" in the database on creation.

Is there a filter I can use?

  • Adam Czajczyk

    Hello Mike,

    I hope you're having a nice day!

    Just to make sure: I assume you already have a wildcard SSL certificate installed for your site, is that correct?

    As for forcing https on subsites. I haven't found any WP action that you could hook to to make WP use https:// by default. The easiest solution would be to use .htaccess to create a redirection on server level but I understand that's not the point.

    Let me then ask our 2nd-line support guys if they can help us here.

    Please keep an eye on this thread for further information and updates!


    • Mike

      Turns out the http:// is hard coded into wordpress:

      function get_blogaddress_by_id( $blog_id ) {
      	$bloginfo = get_blog_details( (int) $blog_id, false ); // only get bare details!
      	return ( $bloginfo ) ? esc_url( 'http://' . $bloginfo->domain . $bloginfo->path ) : '';

      It look like there is a chance wordpress 4.4 will introduce SSL support for multisite: (if anyone reads this and want to make sure it gets added go and follow the ticket so they know it is in demand).

      In the meantime I came up with this workaround that replaces the site options after the blog is created:

      add_action( 'wpmu_new_blog', 'custom_wpmu_create_blog', 10, 6  );
      function custom_wpmu_create_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ){
      	if (switch_to_blog($blog_id))
      		update_option( 'siteurl', "https://" . $domain );
      		update_option( 'home', "https://" . $domain );

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.