Passer la navigation

[Closed] disable code

This support ticket is created Il y a 2 years, 3 months. There's a good chance that you are reading advice that it now obsolete.

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.

Ce sujet contient 2 réponses, a 2 voix.

Dernière mise à jour par Nigel Il y a 2 years, 3 months.

Auteur
Publications
#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='lien caché';}else{ j.rel='stylesheet';j.href='lien caché';} 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="lien caché">
</noscript>

#2688954

help

#2689051

Nigel
Supporter

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+01: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.