I'm using site_url() for my href for anchors. I want to control what when I send the user to a secure page or non secure page. I thought I could do that with site_url('/foo', 'http') and site_url('/bar', 'https') but the scheme is not changing. If I'm on a secure page and site_url('/foo', 'http') is set, the clicked page is still secure instead of non-secure.

1 Answer 1


What is original link?

var_dump( get_option('siteurl') );

If I am interpreting code right then for http protocol argument action is to not change the link. So if you have set up URL to be secure by default then function doesn't override that.

  • Yeah at this point in the site the site url is https. I'm guessing it changes the is_SSL() return.
    – Clutch
    Apr 21, 2011 at 20:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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