Skip to content

Instantly share code, notes, and snippets.

@anka
Created April 7, 2023 18:19
Show Gist options
  • Save anka/3f0a7b754097a1d151d291f10250c4e1 to your computer and use it in GitHub Desktop.
Save anka/3f0a7b754097a1d151d291f10250c4e1 to your computer and use it in GitHub Desktop.
Enqueue a JavaScript file in a custom Wordpress plugin
function custom_route_enqueue_scripts() {
wp_enqueue_script('custom-route-script', plugin_dir_url(__FILE__) . 'custom-route-script.js', array(), '1.0', true);
}
add_action('wp_enqueue_scripts', 'custom_route_enqueue_scripts');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment