I am having a line of code in my header that I can't seem to find where it is coming from, checked both files and database, am sure am missing something, are you guys aware of any methods to find for pieces of code where they are called from ?
Kind regards, Cristian
I am having a line of code in my header that I can't seem to find where it is coming from, checked both files and database, am sure am missing something, are you guys aware of any methods to find for pieces of code where they are called from ?
Kind regards, Cristian
Share Improve this question edited Apr 2, 2019 at 11:12 fuxia♦ 107k39 gold badges255 silver badges459 bronze badges asked Apr 1, 2019 at 12:13 Cristian TrandafirCristian Trandafir 11 bronze badge 6 | Show 1 more comment1 Answer
Reset to default 0Install the String Locator WordPress plugin (free): https://wordpress/plugins/string-locator/
You can then search through all the files on your server, looking for google-analytics
and do some inspection on the files found to see if any of those are the culprit. Chances are it's hard coded in your theme header files, or there's a plugin that's enqueuing the script.
You can also use a DB search and replace plugin, just set config to do a "dry run" to search for google-analytics
to see if it's saved in the db anywhere:
https://wordpress/plugins/search-and-replace/
I would also recommend that you try using a different browser as well to check this, to make sure some Chrome (or whatever browser you're using), that an extension is not injecting that on the page.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745635708a4637379.html
<head>
- I thought you meant HTTP headers. But the advice about changing theme and plugins stands. If this script tag isn't in your theme then it'll be a plugin hooking wp_head and writing it; you could try removing thewp_head()
call from your theme to see if that removes the script tag, else you'll have to search through everything that hooks wp_head to see which one is doing it. – Rup Commented Apr 1, 2019 at 16:36grep
:grep -rn 'www.google-analytics'
will return the files and lines containing the string "www.google-analytics" – phatskat Commented Apr 1, 2019 at 18:02