Script working but only shows after footer not in body

It’s likely that this is due to the script itself positioning the output there. This plugin simply runs the script you provided at the point of the page load that you added it.

Are you able to provide me with the script that you’ve embedded?

Hi David

Thanks for the quick response, the code is below:


<script type=”text/javascript”>var _cb = parseInt(Math.random() * 99999999);document.write(‘<sc’ + ‘ript type=”text/javascript” src=”; + _cb + ‘”></sc’ + ‘ript>’);</script>

Kind Regards


I can see the output at line 3841 of the page output, which is definitely in the footer.

Where are you adding the script? Are you using the classic editor or the block editor?

Im using a block (I think) Gutenburg editor and I get the same when using WPBakery builder

Something is very odd and I’m wondering if your use of WP Rocket is behind it – there’s a comment in your page output to say it’s cleaned and sped up your page, but I notice that the outputted code (by my plugin) doesn’t have the usual comments around it. I’m wondering if WP Rocket has modified the output in some way (one thing that performance plugins will do is move scripts to footers or headers). Does the same occur without WP Rocket active?

I’ve tried with JS no cached, then tried with WP Rocket in safe mode and finally deactivated the WP Rocket plugin (currently still deactivated) It still appears at the bottom 🙁

So very, very odd. Yes, you’re right – that’s definitely turned off now but it’s still doing it.

If you’re in a position to do this, or have a test site, it may be worth just trying to turn off all plugins (other than Code Embed) to see if that makes a change. If not, try a default theme like Twenty Twenty.

Looks like Jetpack Boost was the cause with Defer Non-Essential JavaScript enabled

Ah brilliant – I’m glad you identified it. Yes, I thought something moving around scripts may have been behind that. I’ll bear that in mind if anyone else reports a similar issue!


This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer