Prevent direct access to WordPress plugin assets?


I was wondering if there was a simple way to prevent direct access to asset files within a WordPress plugin. Primarily javascript files.

I’m developing a plugin that’s meant to be used only in the admin dashboard, and I would like the javascript files this plugin uses to not be exposed to the public. It should only be able to be run by a logged-in admin on the dashboard.

Currently, anyone can access a plugin asset file directly through the URL via

So if somewhere were to somehow get that domain they can few the JS file.

Hope that question makes sense.


Dan 2 years 2022-07-02T12:14:12-05:00 0 Answers 0 views 0

Leave an answer