Saltar navegación

[Cerrado] disable code

This support ticket is created 2 years, 3 months ago. 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.

Este tema contiene 2 respuestas, tiene 2 mensajes.

Última actualización por Nigel 2 years, 3 months ago.

Autor
Mensajes
#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='enlace oculto';}else{ j.rel='stylesheet';j.href='enlace oculto';} 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="enlace oculto">
</noscript>

#2688954

help

#2689051

Nigel
Colaborador

Idiomas: Inglés (English ) Español (Español )

Zona horaria: 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' );
}

El debate ‘[Cerrado] disable code’ está cerrado y no admite más respuestas.