Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

158
Vistas
Stop requesting a script from loading in HTML-file

I am trying to stop a script from loading in HTML on my Wordpress website. In my HTML file I can see these two scripts:

<script type="0f1a6d7ca503db410c0d10c4-text/javascript" src='https://www.[-----------].se/wp-content/plugins/theme-my-login/assets/scripts/theme-my-login.min.js?ver=7.1.2' id='theme-my-login-js'></script>

<script type="0f1a6d7ca503db410c0d10c4-text/javascript" src='https://www. [-----------].se/wp-content/themes/guru/framework/js/public/jquery.smartresize.js?ver=5.5.2' id='jquery-smartresize-js'></script>

In public_html/wp-content/themes/guru/framework/register_public.php I can comment out the second script and prevent it from loading to HTML by setting /* */ in the above php file:

/* wp_enqueue_script('jquery-smartresize', $template_uri.'/js/public/jquery.smartresize.js', array(), false, true); */

The first script comes from a plugin that I want to use on a certain page, so I do not want to deactivate the plugin. I will build a IF-statement in the php file to exclude/include the plugin script from loading into HTML based on page URL.

My problem is that I cannot find the php file that loads the first script to HTML, like I found for the second script. I do not find anything interesting or get to many hits when searching via ssh in public_html. Can I ad a filter? How would the code for the filter be? I guess it is better to prevent the wp_enqueue_script from excecuting than to have wp_enqueue_script and then add a filter.

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Yeah you can dequeue the scripts where they're not needed


function SO_21097900() {
    wp_dequeue_script( 'theme-my-login' );
    wp_dequeue_script( 'jquery-smartresize' );
}

if ( isset( $_SERVER['REQUEST_URI'] ) &&
 strpos( $_SERVER['REQUEST_URI'], 'the/page/that/uses/the/scripts' ) === false ) {
    add_action( 'wp_enqueue_scrips', 'SO_21097900', 100 );
}
about 4 years ago · Juan Pablo Isaza Denunciar

0

Actually I only used

if ( isset( $_SERVER['REQUEST_URI'] ) &&
strpos( $_SERVER['REQUEST_URI'], 'the/page/that/uses/the/scripts' ) === false ) 
{wp_dequeue_script( 'theme-my-login' );
}

I did not call on the function SO_21097900...that did not work...I do not know where to put the function. If I put the function in the same php file then my website goes down.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda