plugins_url() function accepts plugin slug or file path to build URL for.
I have following directory structure:
/wp-content/mu-plugins/someplugin/css/file.css
/wp-content/mu-plugins/someplugin/includes/file.php
I need to build URL to file.css in file.php. I can't pass __FILE__ because that will be one level too deep.
plugins_url('css/file.css', __FILE__ )
I can pass __DIR__ to get correct level and it seems to work, but it's not documented as allowed and I am not sure there isn't something to bite me later with this.
plugins_url('css/file.css', __DIR__ )
So, is this adequate? Any better way to build URL for these conditions?
$wpse15731_filewould end withmu-plugins/someplugin/someplugin.php, and it doesn't matter that my code is inincludes/file.phpor somewhere else. – Jan Fabry Apr 27 '11 at 11:23