Is it possible to have css and js scripts outside of template directory? If it is possible, how can I achieve it?

Basically, instead of having:


I want to have:


1 Answer 1


Yes, you can enqueue JS and CSS from anywhere - even other sites. However, your theme will have to have a "style.css" with at minimum the required comments for WP to recognize it as a theme that can be activated.

  • I didn't quite get it. I have WP installed inside the root folder (public_html). The structure of WP files is normal wp-admin, wp-content,... I don't want to have scripts inside root/wp-content/themes/mytheme, but I want them to be outside theme folder. How can I achieve that?
    – dodo254
    Aug 10, 2019 at 14:12
  • Place them wherever you want, but enqueue them from root/wp-content/themes/mytheme/functions.php - just give the full server path to wherever you've put them.
    – WebElaine
    Aug 12, 2019 at 13:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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