Support » Plugin: reBusted! » Not working: wp_enqueue_script

  • Resolved Tom

    (@tderkowski)


    Greetings,

    None of our scripts, which are registered via wp_enqueue_script, are getting picked up by reBusted!:

    wp_enqueue_script( 'main', get_template_directory_uri() . '/js/main.js', array( 'jquery' ) );

    All stylesheets do however get picked up. Is there a known issue or are we doing something wrong? Have tried creating minimal examples based off WP Codex and nothing seems to get reBusted! recognizing scripts.

    Thank you!

    • This topic was modified 1 year, 4 months ago by Tom.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Simon Prosser

    (@pross)

    Is your code in an action? Is there more of it?

    It should work with any css/js as long as the file exists.

    Thread Starter Tom

    (@tderkowski)

    That’s really it – it enqueues the script, the script works, but reBusted! doesn’t pick it up to append the cache busting query string. Originally this was a more complex example (jQuery dependency, placed in footer, etc.) – but no matter how much we strip the example down we just can’t get rebusted! to pick up any scripts.

    Plugin Author Simon Prosser

    (@pross)

    So.. the entirety of your script is wp_enqueue_script( 'main', get_template_directory_uri() . '/js/main.js', array( 'jquery' ) );? No actions, nothing?

    This works:

    add_action( 'wp_enqueue_scripts', function() {
      wp_enqueue_script( 'main-test', get_template_directory_uri() . '/js/test.js', array( 'jquery' ) );
    });

    Either your code is not in wp_enqueue_scripts action, or maybe the handle main is used already, try and be unique, or maybe the file does not exist, why are you enqueing a file from the main theme folder should it be stylesheet directory?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Not working: wp_enqueue_script’ is closed to new replies.