WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

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

So I'm trying to link in a javascript file the right way, by using this:

function custom_scripts() {
    console.log("test - inside custom_scripts"); 
add_action( 'wp_print_scripts', 'custom_scripts');

I don't see the console logs in the chrome console window, and I'm not sure if I should see them or not. However I see that one of my files cannot be found: /backdrop.js?ver=3.5.1. The directory is correct but the ?ver=3.5.1 obviously doesn't match up. Since I'm manually registering the script in a custom functions.php, why does it still do this?

share|improve this question
where is your script exactly? in your theme directory, or the root of your domain? – Milo Apr 24 '13 at 1:45

console.log() is a JavaScript function. You cannot use it in PHP. Add that to your JavaScripts.

The version parameter should not affect the file access. But you can remove that parameter and see if it works then. If it does, your server configuration needs further inspection, because it should also work with the version.

share|improve this answer
Oh lol, that's what you get when you are learning 2 languages simultaneously >_> And wow, that did the trick. thank you! – blake miller Apr 24 '13 at 2:23

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.