Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a plugin that allow my users in multisite to generate simple urls like http://example.com/user/?my_url=2DD0B8183 but i want to include the https instead http ...

echo '<div>';
    echo '<div><input type="text" class="url" value="' .get_option('home'). '/?my_url=' . $download["code"] . '" onclick="this.select();" /></div>';
    exit();
  }

I tried

echo '<div><input type="text" class="url" value="https://' .get_blogaddress_by_id( $user_info->primary_blog ) . '?my_url=' . $download["code"] . '" onclick="this.select();" /></div>';

but i get https://http://example.com/user/?my_url=C4785825B

I have already forced ssl/https for entire my network via .htaccess

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
share|improve this question

1 Answer 1

Instead of get_option, use home_url which will determine ...

the appropriate protocol, "https" if is_ssl() and "http" otherwise. If the $scheme argument is "http" or "https" the is_ssl() check is overridden.

In fact, network_home_url would be more appropriate since you are talking about Multisite.

Those should return the same value that you are trying the access in your code-- the home option key-- but with the appropriate protocol.

This may not be the URL you want though. You may want site_url or the multisite equivalent, network_site_url.

share|improve this answer
    
@Ghinnersmee : yep. I used a function that returns the same address as get_option('home'), which you were trying to use, but with the appropriate protocol. What you needed was a different address altogether. I will update the answer for future visitors. –  s_ha_dum Jun 25 '13 at 22:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.