3

I have a WordPress site with an SSL certificate. It all works fine, except that this little insecure shield icon shows up because the header has an enqueued non-https script. enter image description here

The issue is that I don't know which plugin is enqueuing this script into the header in order to change it into https. Is there any way I could track down where the script is being enqueued from? Any help would be appreciated!

Btw, in case it helps, the unsafe script that is being enqueued is the google maps script (http://maps.google.com/maps/api/js?sensor=false&ver=4.2.10)

1

2 Answers 2

2

There is no filter when a script is registered, so it is hard to track that down. Use a full text search in all your theme and plugin files to find the source.

In addition, you can filter the URL before it is printed:

add_filter( 'script_loader_src', function( $url ) {
    if ( 0 !== strpos( $url, 'http:' ) )
        return $url;

    return substr( $url, 5 );
});

This will create an URL without protocol, so the browser will just use the same protocol (here: HTTPS) as your site.

1
  • Didn't work for me /: I think the script is being asynchronously enqueued so that may be why. I ended up finding the value in the db and changing it there. Thanks anyway! Commented Jan 7, 2017 at 15:51
0

The issue is that I don't know which plugin is enqueuing this script into the header in order to change it into https.

The easy way @EmilioVenegas is to remove the plugins, one by one, and check.

You can try to alter the

http://maps.google.com/maps/api/js?sensor=false&ver=4.2.10

to start with

//maps.google.com/maps/api/js...

If not a plugin it may be the theme.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.