Retrieving a path when dealing with composer packages

Within my composer package, I require a script be enqueued, I get its “base” path with plugin_dir_url( __FILE__ ) and then append Assets/JS/my_script.js to get the full path, problem is, if someone installs my package and uses it inside a theme, that function isn’t going to work, yet the package itself is supposed to work just fine.

What is the alternative here? Isn’t there a function that tells me the current path I’m in, no matter if a plugin or theme?

Read more here:: Retrieving a path when dealing with composer packages

Leave a Reply

Your email address will not be published. Required fields are marked *