[wp-hackers] Best way to avoid mixed http/https content

Nicholas Ciske nl at thoughtrefinery.com
Fri Feb 28 15:54:25 UTC 2014


This just came up in a recent thread, I think, but I can't find it in the archive.

The gist was: 

Either filter post content to switch http:// to https:// (or vice versa) or use protocol relative urls:
http://www.paulirish.com/2010/the-protocol-relative-url/

Ideally you'd switch to protocol relative URLs on save_post instead on display for maximum performance (i.e. then you're only filtering the content once).

_________________________
Nick Ciske
http://thoughtrefinery.com/
@nciske	

On Feb 28, 2014, at 6:13 AM, David Anderson <david at wordshell.net> wrote:

> Hi,
> 
> I'm aware that there are *lots* of ways to avoid mixed http/https content warnings, but I'm looking for any insight into the best way of doing this. The use case is for a site that is intended to be available over both http and https.
> 
> In particular, I'm talking about content inside posts. (Not about the admin area, or plugin resources (e.g. JavaScript, CSS)).
> 
> The WordPress editor always inserts full links for media. i.e. It includes the uploads URL setting (which can of course be set in different ways). This is good, because it means that you can move the site from one place to another, and you just need to search/replace the URLs. However, that doesn't work well if the site is meant to be available via both http and https. It'll cause mixed content warnings.



More information about the wp-hackers mailing list