When I console.log(wp) the object only includes: -wp.emoji -wp.heartbeat -wp.svgPainter

Script is loaded in the footer and last in the DOM. What am I missing?


Ah, I get it. When you enqueue your admin script, add 'wp-util' as a dependancy.

    wp_enqueue_script( 'script_handle', plugin_dir_url( __FILE__ ) . 'script.js', array( 'jquery', 'wp-util' ), '1.0', true );
  • If this answer solved your problem, be sure to accept and mark it as correct. – Adam Feb 13 '16 at 4:22
  • :@Justin W Hall: – Bhavik Hirani Jan 27 '17 at 5:46
  • Where to put this text.... – Bhavik Hirani Jan 27 '17 at 5:46
  • In your plugin or functions.php – Justin W Hall Jan 27 '17 at 22:59
  • perfect! saved me a lot of time! – Richard Varno May 20 '19 at 19:57

In my case I had W3 Total Cache installed, and Minify option was set to Manual.

After I removed wp-underscore script from manual minify list, issue with the wp.template() Not a function was gone.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.