JS snippet auto insert in footer does not work
-
Hi All – I am seeking help as I can not get the JS snippet running as expected.
I created a JS snippet, set it to auto insert, select site wide footer and everything else is default. The snippet is active.
When loading the page, I can see that the function is shown in the index file (via developer tools sources) but it is NOT executed (console log doesn’t show).function JSsnippet1(){
console.log('Test JSsnippet1#');
}Then I added a PHP snippet, set it to auto insert, run everywhere and everything else is default. The snippet is active.
When loading the page, I can see that the function is shown in the index file (via developer tools sources) and it works properly! (console log is shown).add_action("wp_footer", "JSsnippet2", 999999);
function JSsnippet2(){
?>
"script" console.log('Test JSsnippet1#'); "script"
<?php
}
Note: I can not copy the “script” tags in here, in my code they are correct with <>Does one of you have any idea why the JS snippet does not work but the PHP snippet does?
- The topic ‘JS snippet auto insert in footer does not work’ is closed to new replies.