wp_enqueue_script Doesn’t Work?

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:

Read More
<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!

Related posts

Leave a Reply

1 comment

  1. 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!