The code to disable:
<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='/wp-content/plugins/wp-views/vendor/toolset/blocks/public/js/frontend.js?v=1.5.2';}else{ j.rel='stylesheet';j.href='/wp-content/plugins/wp-views/vendor/toolset/blocks/public/css/style.css?v=1.5.2';} 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="/wp-content/plugins/wp-views/vendor/toolset/blocks/public/css/style.css"></noscript>
What needs to be registered in the functions.php file so that this code does not appear on the site?
Hello, I'm not aware of an easy way to disable this code but I will ask my 2nd tier support team if it is possible to dequeue it somehow. I'll let you know what I find out when they return tomorrow.
It would be great to have in the plugin settings a special option to disable the addition of such scripts and css to the code.
The Toolset Blocks script frontend.js isn’t enqueued normally, an inline script is added to the page to load the script asynchronously. This can be disabled by adding the following constant to wp-config.php:
define( 'TB_SCRIPT_STYLE_LAZY_LOAD', false );
Then the script itself and accompanying stylesheet can be dequeued normally as desired, like so:
add_action( 'wp_print_scripts', 'ts_debug_scripts' );
function ts_debug_scripts( $handles ){
wp_dequeue_script( 'toolset-blocks' );
wp_deregister_style('toolset-blocks');
}
Let us know if this snippet is not working for you.
/wp-content/plugins/wp-views/vendor/toolset/blocks/public/css/style.css
This css is still in the code after applying your recommendations
wp_deregister_style('toolset-blocks');
This should have apparently been written in the code.
Okay thanks for the update, I'll let my 2nd tier team know that the snippet should be updated to also deregister the stylesheet. Does that completely remove the code, or is anything else overlooked now?
My issue is resolved now. Thank you!