-1

I just got my website a ssl and i was making sure there aren't any mixed contents. But looks like everything else is working good except a form generated by plugin (The Newletter Plugin), that uses home_url in a lot of places. The url generated is http only even though my urls in general settings are https.

So, i was wondering that is there a global way to force that all urls generated through wordpress functions generate secure link?

I know force_ssl_admin for admin part and i know you can use home_url('/','https') and change all links that way. But i dont want to change the plugin everytime i update.

Or if i may missing something completely, please let me know. Thanks

  • Just curious, what is your settings on wp-admin setting panel (clicking on Settings -> General) for WordPress Address (URL) and Site Address (URL)? and what type of content that have http? are those past-generated content or new content? – hcheung Mar 11 '17 at 4:59
  • Both the site url and the wordpress url are in https – dabishan Mar 15 '17 at 4:33
0

This sounds like a bug in the plugin, and they should fix it. But if they don't, you can always add a filter to home_url and change all http:// to https:// like so:

add_filter( 'home_url', 'wpse_259675_home_url', 1000, 4 );
function wpse_259675_home_url( $url, $path, $orig_scheme, $blog_id ) {
  return str_replace( 'http://', 'https://', $url );
}
  • Not sure if it is a bug. But the plugin definitely hasnt implemented anything to check if i am using it in a https website. It simply replied on home_url('\') to generate the links for the forms. Also I added your code, but it doesnt seem to help my cause! Thanks though – dabishan Mar 11 '17 at 1:46
  • The code above simply replaces all occurrences of of http:// with https:// that is output by the home_url() and get_home_url() functions. If it's not changing anything, then the non-https links are probably not being generated by home_url(). – Nathan Johnson Mar 11 '17 at 2:31

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.