I have a wordpress multi-site implementation. I am a developing a custom plugin for this implementation. Is it possible to include a script based based on the site. if site is mydomain.com/uk :- script_uk.js need to be loaded if site is mydomain.com/us : - script_us.js need to be loaded.


1 Answer 1


Why don't you use simple Javascript/jQuery's function to check the url and enqueue the relevant js/css files? You may use the below js line to achieve your task:

if(window.location.href == 'YOUR_DESIRED_URL') {
   // ENQUEUE JS 1

If you want to use php's function, you may also do that.

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.