This doesnt work for Plugin get_template_directory_uri()

get_template_directory_uri works in a plugin, in that it returns the active theme directory URI, which is what the template directory is.

If you’re trying to get the URI for your plugin assets, then you want plugin_dir_url.

wp_enqueue_script(
    'jquery-repeater-form',
    plugin_dir_url( __FILE__ ) . 'js/sample.js'
);

Leave a Comment