I am using wp_enqeue_script to link to a custom.js file in my plugins folder. However I am expecting a link to show up on the page but it doesn’t is there something else I am supposed to other than place this in the header.
<?php wp_enqueue_script('myscript', '/wp-content/plugins/myplugin/myscript.js'); ?>
When and where to load styles & scripts 1) & 2)
Pathes should stay relative 3)
Debugging
1st check if the
<script>
is present in your pages source code.✓ → The file was hooked
× → The hook is wrong (mostly too late)
2nd check if a file is missing with your Chrome Dev Bar or FF Firebug.
✓ → The file was found
× → The path or filename is wrong (mostly typo or wrong path function)
3rd try to call the file from it’s path manually to determine if you have no typo.
✓ → The file was found
× → The path or filename is wrong (mostly typo or wrong path function)
Notes about sources:
1. Above is a quote Quote from WP Devel about where to add calls to
wp_enqueue/register_script/style()
:2. Look at the related codex page to read the same about the hooks to use
3. Another answer here on WPSE about pathes, that sums up whatcan be read in codex