From both scripts, only 'custom.js' is loaded, not common.js

this is in my functions.php file:

function custom_scripts () {
    if (!is_admin()) {

        wp_enqueue_script('common', get_bloginfo('template_directory') . '/js/common.js', array(), '1.0', true );
        wp_enqueue_script('custom', get_bloginfo('template_directory') . '/js/custom.js', array(), '1.0.1', true );


add_action("wp_enqueue_scripts", "custom_scripts");

any idea whyy?

  • Is it not working? Or not being loaded at all? There's no script tag in the document at all? Also, wp_enqueue_scripts doesn't run in the admin, so ! is_admin() is redundant. – Jacob Peattie Nov 16 '18 at 12:09
  • 1
    Try to change handler (common) name. – Pratik Patel Nov 16 '18 at 12:12
  • @PratikPatel That worked, didn't know it was a reserved word. is it? – Toni Michel Caubet Nov 16 '18 at 12:19
  • Yes may be its reserved word so thats why your script not load. – Pratik Patel Nov 16 '18 at 12:21
  • 1
    common is used from WordPress itself. Though I usually advise for deleting questions, I think you should not in this case and let @PratikPatel write up an answer. Feels like this could be important for future visitors (with my comment I wanted to provide the link for where WP uses this) – kero Nov 16 '18 at 12:38

Please try to change handler common name.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.