WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My wordpress site supports http and https. What I want to do is to add a widget when surfing over http that says something like "Surf this site secure" to show the visitor that I also have a secured version.

I don't want to force them to surf over SSL because I'm using a type of certificate that's not supported on Windows XP.

Now how can I do this?

share|improve this question
up vote 2 down vote accepted

WordPress has built-in function for this purpose - is_ssl(). http://codex.wordpress.org/Function_Reference/is_ssl

So, you should edit this widget and put something like

if ( is_ssl() ) {

} else {
    echo 'you should use ssl';
share|improve this answer

try this one

if ($_SERVER['HTTPS'] != "on") { 

    //your code

share|improve this answer

Your Answer


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.