I've added wp_enqueue_media() to a specific page (before including the header) on my custom theme but it flat out will not any of the JS on the page.

I've already done the basic troubleshooting:

  1. Deactivated all plugins (no go)
  2. changed themes to twenty sixteen, this time leaving all the plugins activated, and added wp_enqueue_media() function to the page.php template (that works)
  3. moved the function to the wp_head (still doesnt work)
  4. commented out everything from my functions file (thus stopping any of my JS,styles, and hooks from being loaded - but this also doesn't work)
  5. Cleaned the DB and did a fresh install (doesn't work)

so steps 1 and 2 rules out plugin conflicts, and 4 should rule out something in my functions file. I dont know where to go from here.

note - In my functions file, I was unregistering jquery to use a different version. When I did that, nothing loaded with the wp_enqueue_media function. But when I commented out that line I was able to get a few more scripts:

  • 1
    Why wp_enqueue_media()? This is only meant to load media JS API scripts, styles and markup. What JavaScript files are we talking about? Why are you not using wp_enqueue_script()?
    – N00b
    May 2, 2016 at 19:33
  • I want to get the media library (including media uploading) and the wp_enqueue_media() function should enqueue all the js files needed
    – rugbert
    May 2, 2016 at 19:39
  • Yes, it should load everything related to media upload (including JS, HTML and CSS). Im not sure how many files it should load.. How do you know that it doesn't load all required files? Did you test media upload? From documents: This function should be called from the 'admin_enqueue_scripts' action hook, or later. Make sure that all requirements are met, here's more information about it.
    – N00b
    May 2, 2016 at 19:46
  • Ah I figured it out. You put me in the right direction. See answer below
    – rugbert
    May 2, 2016 at 20:15

1 Answer 1


I had 2 things wrong:

  1. I unregistered wordpress's jquery without properly registering my own (I concatenated my scripts )
  2. I didnt have wp_footer() in my theme. the wp_enqueue_media() function loads the scripts to the footer.

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.