• I know it seems really simple, but I am having a strange problem. I can’t figure out how to correctly call a javascript file. I called a stylesheet like this: (I think this is correct?)
    wp_enqueue_style('my-plugin-css', plugins_url('style.css',__FILE__));

    But calling javascript files like this isn’t working:
    wp_enqueue_script('my-plugin-js', plugins_url('functions.js',__FILE__));

    The link is correct because i see the <script> thing in the head, but when I try to call one of my functions, my debugger says that the function is undefined. Currently, I am just echoing it within the body and it works fine. What could the problem be?

  • The topic ‘How to include a javascript file in head of plugin’ is closed to new replies.