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 am looking to override a function in functions.php through a theme or plugin. Specifically, is_ssl(), which does not have any filter or action hooks. Obviously, the easy why would be to update functions.php itself, but this will leave issues with upgrade and compatibility. How could this be done.

Edit: The goal is to overwrite is_ssl() function to return true when specific flag is set in the request header.

Is it possible with the override-function?

share|improve this question

2 Answers 2

You cannot override a function once it is defined. That is pure PHP. Some functions are wrapped in a conditional that lets you cheat around this-- look at pluggable.php. Otherwise, you just can't do it. You'll get a fatal error.

Your best bet to solve this is probably a child theme but without a lot of details I couldn't say how to go about it, and even so success depends on how cooperative your 'parent' theme is. It may be written inis uch a way as to make this very hard on you.

share|improve this answer

If you look at the source of the is_ssl() function you'll see it checks various $_SERVER variables. Therefore, you could try adding this to a plugin:

if ( isset( $_SERVER['HTTP_MY_CUSTOM_HEADER'] ) )
  $_SERVER['HTTPS'] = 'on';

You'd need to call that code as early as possible, ie. directly in the plugin body rather than on a hook.

share|improve this answer
Thanks, good suggest. Will test this out. –  ltfishie Feb 5 '13 at 19:40

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.