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

90
Vistas
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
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