1

I have a simple call to the wp_enqueue_scripts hook but it won't run the function:

add_action( 'wp_enqueue_scripts', 'add_gz_scripts' );
function add_gz_scripts() {
    wp_register_script('hdgzjs',plugins_url('/js/hdgz.js', __FILE__),'','',true);
    wp_enqueue_script('hdgzjs');
}

I'm not getting a "file not found" on the js file and I'm not getting in php errors. It's just not running the function. I've tried echoing inside the function to test and it won't even echo. Aside from this the plugin activates and runs fine.

1
  • Glad to know that and I'm deleting the answer and you just put your own answer as you described in the comment for future reference. Commented Apr 18, 2013 at 18:41

1 Answer 1

9

For anyone who comes across this:

add_action( 'wp_enqueue_scripts', '...' ); is for site side add_action( 'admin_init', '...' ); is for admin side

When you stare at code too long it's easy to overlook doing this.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.