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:
My Question:
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).
The inline script is still output even if the enqueued file request is blocked. AFAIK anyway, not verified, but I’m pretty sure this is the case. The inline output cannot know the enqueued request was blocked, the block is external to the server. Of course, the added inline cannot be dependent on the blocked enqueued script if it is to work correctly. Your ad content would need to be part of the inline script, any external requests can still be blocked.
While AdBlock cannot block inline script, it can remove specific DOM elements. The key is to avoid having any consistent identifiers in your ad elements.