Skip Navigation

[Closed] disable code

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 2 replies, has 2 voices.

Last updated by Nigel 11 months ago.

Author
Posts
#2688943

What commands in the function can I use to disable adding this code to the text of the site?

<script> window.addEventListener("load",function(){ var c={script:false,link:false}; function ls(s) { if(!['script','link'].includes(s)||c[s]){return;}c[s]=true; var d=document,f=d.getElementsByTagName(s)[0],j=d.createElement(s); if(s==='script'){j.async=true;j.src='hidden link';}else{ j.rel='stylesheet';j.href='hidden link';} f.parentNode.insertBefore(j, f); }; function ex(){ls('script');ls('link')} window.addEventListener("scroll", ex, {once: true}); if (('IntersectionObserver' in window) && ('IntersectionObserverEntry' in window) && ('intersectionRatio' in window.IntersectionObserverEntry.prototype)) { var i = 0, fb = document.querySelectorAll("[class^='tb-']"), o = new IntersectionObserver(es => { es.forEach(e => { o.unobserve(e.target); if (e.intersectionRatio > 0) { ex();o.disconnect();}else{ i++;if(fb.length>i){o.observe(fb[i])}} }) }); if (fb.length) { o.observe(fb[i]) } } }) </script>
<noscript>
<link rel="stylesheet" href="hidden link">
</noscript>

#2688954

help

#2689051

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi there

The script frontend.js is added in a different way than scripts are normally enqueued, making it harder to remove.

To make it so the script is enqueued normally (so that it can then be dequeued normally) you need to add the following line to your wp-config.php file:

define( 'TB_SCRIPT_STYLE_LAZY_LOAD', false );

Then you can add the following, as a snippet at Toolset > Settings > Custom Code or to your child theme's functions.php:

add_action( 'wp_print_scripts', 'ts_dequeue_scripts', 1 );
function ts_dequeue_scripts( $handles ){
    wp_dequeue_script( 'toolset-blocks' );
}

The topic ‘[Closed] disable code’ is closed to new replies.