0
votes

I'm getting an error and the website is blocked in chrome for no reason.

Because it's a small site I have all pages forced to be in SSL. And getting this error:

[blocked] The page at 'https://www.splitapartments.co/' was loaded over HTTPS, but ran insecure content from 'http://fonts.googleapis.com/css?family=Open+Sans:400,800,300,700': this content should also be loaded over HTTPS.

The WordPress theme enqueue google fonts safe mode:

function dt_get_google_fonts( $font = '', $effect = '' ) {
    if ( ! $font ) {
        return;
    }

    if ( array_key_exists( $effect, dt_get_web_fonts_effects() ) ) {
        $effect = '&effect=' . esc_attr( $effect ); 
    } else {
        $effect = '';
    }

    $protocol = "http";
    if ( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == 'on' ) {
        $protocol = "https";
    }
    ?>
    <link rel="stylesheet" type="text/css" href="<?php echo $protocol; ?>://fonts.googleapis.com/css?family=<?php echo str_replace( ' ', '+', $font ) . $effect; ?>">
    <?php
}

function dt_make_web_font_uri( $font, $effect = '' ) {
    if ( !$font ) {
        return false;
    }

    // add web font effect
    if ( function_exists('dt_get_web_fonts_effects') ) {

        if ( array_key_exists( $effect, dt_get_web_fonts_effects() ) ) {
            $effect = '&effect=' . esc_attr( $effect ); 
        } else {
            $effect = '';
        }

    } else {
        $effect = '';
    }

    $protocol = is_ssl() ? "https" : "http";

    $uri = $protocol . '://fonts.googleapis.com/css?family=' . str_replace( ' ', '+', $font ) . $effect;
    return $uri;
}

I'm totally confused about why is this happening. I tried every solution that I can find, but nothing works.

1

1 Answers

-1
votes

Had this problem for a while, but have finally got to the bottom of it. I had installed a wordpress plugin which hard coded the line "http://fonts.google... etc".

Once I disabled the plugin, everything was fine! (I could have edited it I suppose, but I didn't need it any more).

The plugin that caused me the issue was: WP Construction Mode