Wordpress error due to <script>

I have inherited a wordpress site and have just noticed in Firefox some icons are not displaying. They are OK in both Edge and Chrome.

Anyway I ran the site through the Firefox developers browser and get an error:

SyntaxError: expected expression, got ‘<’ [Learn More] website:880:2

It looks like a < script > has gone wrong somehow. Now if I was in control of the site I would just remove the < script > and < /script > but as Wordpress is in control I am not sure what to do. What would be the best thing to do ( I would not even know where to look for the offending < script > )?
This is nothing to do with my icons but could it stop them displaying - the website still works OK apart from the missing icons in as I say Firefox. If I get this error cleared we can see what happens.

879   <script type="text/javascript">
880		<script async defer src="https://maps.googleapis.com/maps/api/js?key=AAAAAAAA&callback=initMap"
881     type="text/javascript"></script>		</script>

Could you check/load the source code direct in an editor and also use the other browsers’ dev tool to see if the nested tag is present there too?

Just to rule out that Firefox isn’t the culprit here. I can’t recall ftm, but the error sounds familliar.

And, again if I’m not mistaken, the dev tool shows the code as the browser see it after it has done the error correction it’s capable of.

I installed a theme update a couple of days ago and thought that could be the problem but I have a local copy of the site with the old theme and the same code in the view source.

Using the Edge and Chrome view source I have the same code as Firefox.

A note about the images: They were set using visual composer and appear when scrolling down the page. Still missing on Firefox with old and new theme version. So assuming a Firefox problem and nothing to do with the script warning?

I contacted the theme creator and they located the problem - the original site creator added some code to a custom JS file. I thought the code had been added through Visual composer.

Just need to find out how to fix it now.

removed the code in the custom JS file and I am left with below and no errors:

		<script type="text/javascript">
				</script>

Thanks for the help @Erik_J

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.