I want to add inline Javascript on footer of my wordpress site. I know we can add inline Javascript using wp_add_inline_script. From my understanding from Codex tutorial, we have to register and enqueue scripts and then using wp_add_inline_script.
Let say I:
- Register ScriptA.js using wp_register_script.
- Enqueue ScriptA.js using wp_enqueue_script.
- Add inline ScriptB.js using wp_add_inline_script with handle ScriptA.js.
My Question:
- As far as I can remember, Adblock Plus (Web browser ext) or similar can block external .js. If my ScriptA.js being blocked by Adblock Plus, will my ScriptB.js loaded?
- IF it is blocked, is there any other proper way I can add inline Javascripts? The only I can think is simply print (echo) it using wp_footer hook.
Reason using inline Javascripts: To prevent Adblock user from blocking my Ads script. Because Adblock Plus cannot block inline script as said by their Dev.
DISCLAIMER: This is not my own answer. I simply copy paste this answer from Wordpress support forum. Credit goes to @bcworkz (Wordpress moderator/developer).