I'm loading a custom script (app-min.js
) into a WordPress site. From the site's functions.php
:
wp_enqueue_script('app-min', get_template_directory_uri() . '/app/app-min.js', false, 1.0, true);
Works fine on the frontend, but the script is also loaded in the admin panel:
Why is this happening and how can I avoid it?
You could exclude it from the admin panel by using
is_admin
condition. So your code would be something like this:is_admin
DocsLet me know if it works for you!