Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

156
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!