WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

It's pretty standard, I enqueue script and style for admin page.

function admin_custom(){
    wp_enqueue_script('js', plugins_url('adm.js', __FILE__));
    wp_enqueue_style('css', plugins_url('adm.css', __FILE__));

add_action('admin_enqueue_scripts', 'admin_custom');

The result:

<link rel='stylesheet' id='css-css'  href='http://localhost/wp/wp-content/plugins/manager/adm.css?ver=3.5.1' type='text/css' media='all' />
<script type='text/javascript' src='http://localhost/wp/wp-content/plugins/manager/adm.js?ver=3.5.1'></script>

But it doesn't work. Style is working, but the script is not loaded. I put the css and js in the same folder. It doesn't make sense for me. Any help will be appreciated, I spent last day for this problem. Thanks!

share|improve this question
when you say the script is not loaded, is it returning a 404? – Milo Mar 11 '13 at 2:08
@Milo: I used inspect element in Chrome, when I clicked css link, my code was there, but when I clicked js link, it was blank. – shankshera Mar 11 '13 at 2:14
That code should work, and does work when I test it. Make sure the path is correct and check the permissions on the file. – s_ha_dum Mar 11 '13 at 4:10

I was having this same problem too, turns out the function wp_enqueue_scripts(), removes any blank spaces from your template directory folders. So say your folder name is this theme, the function will make it thistheme, which will then cause an incorrect directory link. Try changing the folder names around if this is the case, otherwise it worked for me so good luck!

share|improve this answer
An additional note: this is because (unencoded) spaces are invalid characters in URLs. Even if wp_enqueue_scripts didn't strip the spaces there is a good chance the URL wouldn't work. – s_ha_dum Jul 10 '13 at 2:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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