This is my code to enqueue scripts. The later one with title yourscript2 is working, but the first one with title upload is not working:

add_action( 'wp_enqueue_scripts', 'add_my_script' );
function add_my_script() {
        get_template_directory_uri() . '/js/upload.js',
        array( 'jquery' )

        get_template_directory_uri() . '/js/text.js',
        array( 'jquery' )
  • 1
    Have you looked at page source and verified that the script tag is not present? Is the filename and path correct? I also suggest using a handle more unique than upload.
    – Milo
    Commented Nov 21, 2015 at 18:02
  • When I test this, it works insofar as the appropriate markup is inserted into the page.
    – s_ha_dum
    Commented Nov 21, 2015 at 18:03

1 Answer 1


Your upload.js is not being added because there is already an script added by wordpress as default for the handler upload.

So I suggest you to change the handler. If not, you can de-register the upload handler registered by wordpress

wp_deregister_script( 'upload' );

and then register yours as usual. But I highly recommend you to not de-register defaults function(which will lead to lot of conflict in upload of wordpress), so instead just change your handler.

@s_ha_dum the upload is inserting for you because the upload handler is not in latest wordpress versions. List of scripts registered by wordpress as of v3.8. So Usman Ahmed Mani might be using an old version of wordpress which has that upload handler

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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