Hello friends i have this <script type="text/javascript" src=".php/tho_lionlaw_com_v2"></script>
form link in many wordpress pages, i would like to either replace the link with custom link or to be able to replace "src" attr to something else to stop it from loading
please note: that i already have tried this using script_loader_tag, but it replaces all attrs instead of that specific link from pages
thanks to all in advance
Hello friends i have this <script type="text/javascript" src="https://thompsonlaw.formstack/forms/js.php/tho_lionlaw_com_v2"></script>
form link in many wordpress pages, i would like to either replace the link with custom link or to be able to replace "src" attr to something else to stop it from loading
please note: that i already have tried this using script_loader_tag, but it replaces all attrs instead of that specific link from pages
thanks to all in advance
Share Improve this question edited Nov 14, 2020 at 14:03 fuxia♦ 107k38 gold badges255 silver badges459 bronze badges asked Nov 14, 2020 at 14:01 AsadAsad 1 6- i have more than 70+ pages having that link and its not easy to edit all pages to remove it so i am looking for a easy way around – Asad Commented Nov 14, 2020 at 14:03
- How is this being added to the pages? Is it in the post content? Via the enqueue script system? A part of the theme templates? – Tom J Nowell ♦ Commented Nov 14, 2020 at 14:42
- @TomJNowell its in page content in raw html avada theme is used – Asad Commented Nov 14, 2020 at 14:48
- I see, then this isn't something a code change can help you with, what you need is a search replace tool – Tom J Nowell ♦ Commented Nov 14, 2020 at 14:50
- @TomJNowell Preg_replace? or str ? – Asad Commented Nov 14, 2020 at 14:52
1 Answer
Reset to default 0Much like all programming, there are many ways to go about solving this. One way is using an id tag id = "script_lionlaw" (or name is whatever you want) within the script.
<script type="text/javascript" src="https://thompsonlaw.formstack/forms/js.php/tho_lionlaw_com_v2" id = "script_lionlaw"></script>
You could then use jquery (or some other means) to grab the tag and then replace it with whatever you want.