Skip to content

Instantly share code, notes, and snippets.

@LouWii
Last active December 15, 2016 04:09
Show Gist options
  • Select an option

  • Save LouWii/11b7cd3d5ced40366115 to your computer and use it in GitHub Desktop.

Select an option

Save LouWii/11b7cd3d5ced40366115 to your computer and use it in GitHub Desktop.

Revisions

  1. LouWii revised this gist Jan 5, 2016. 1 changed file with 4 additions and 3 deletions.
    7 changes: 4 additions & 3 deletions functions.php
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,10 @@
    //Custom to handle embedded content without https
    //Add this code to the end of the functions.php file of your wordpress theme
    // This forces images urls and links of your website to be displayed with https
    function force_https_the_content($content) {
    if ( is_ssl() )
    {
    $content = str_replace( 'src="http://canada.with.susie.and.louwii.fr', 'src="https://canada.with.susie.and.louwii.fr', $content );
    $content = str_replace( 'href="http://canada.with.susie.and.louwii.fr', 'href="https://canada.with.susie.and.louwii.fr', $content );
    $content = str_replace( 'src="http://my-domain.tld', 'src="https://my-domain.tld', $content );
    $content = str_replace( 'href="http://my-domain.tld', 'href="https://my-domain.tld', $content );
    }
    return $content;
    }
  2. LouWii created this gist Jan 5, 2016.
    10 changes: 10 additions & 0 deletions functions.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    //Custom to handle embedded content without https
    function force_https_the_content($content) {
    if ( is_ssl() )
    {
    $content = str_replace( 'src="http://canada.with.susie.and.louwii.fr', 'src="https://canada.with.susie.and.louwii.fr', $content );
    $content = str_replace( 'href="http://canada.with.susie.and.louwii.fr', 'href="https://canada.with.susie.and.louwii.fr', $content );
    }
    return $content;
    }
    add_filter('the_content', 'force_https_the_content');