Is it safe to pass directory path to plugins_url()?

__DIR__ is rather new and not always supported. Use dirname( __FILE__ ).

plugins_url() is using …

$folder = dirname(plugin_basename($plugin));

… so yes, it is safe.

Just use plugins_url( 'subfolder/file.css', dirname( __FILE__ ) )

Leave a Comment

tech