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

89
Views
Why aren't my custom JavaScripts firing consistently despite enqueuing in the footer of a WordPress site?

I have multiple JavaScript scripts in separate files which must be fired on different pages. They are executed in the footer using wp_enqueue_script(). They work, but not consistently. I even added setTimeout to make sure they load last as they have to fill up some fields in the body. Why is it not firing sometimes?

Is there anything wrong here?

// passenger elevators
add_action('wp_enqueue_scripts', 'passen_elev_custom_js');

function passen_elev_custom_js() {
  if( is_page( 4744 ) ) {
    wp_enqueue_script('passenger-elevators', 'https://mywebsite.com/passenger-elevators.js',
    array(), false, true);
  }
}

// home elevators
add_action('wp_enqueue_scripts', 'home_elev_custom_js');

function home_elev_custom_js() {
  if( is_page( 5231 ) ) {
    wp_enqueue_script('home-elevators', 'https://mywebsite.com/home-elevators.js',
    array(), false, true);
  }
}

// observation elevators
add_action('wp_enqueue_scripts', 'obs_elev_custom_js');

function obs_elev_custom_js() {
  if( is_page( 5343 ) ) {
    wp_enqueue_script('observation-elevators', 'https://mywebsite.com/observation-elevators.js',
    array(), false, true);
  }
}
about 4 years ago · Juan Pablo Isaza
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!