wp.template() Not a function

When I console.log(wp) the object only includes:

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

2 Answers

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 );

Leave a Comment