[wp-hackers] Determining URL from within a plugin

Matthew Butt matt at preinvent.com
Wed Jan 25 13:52:57 GMT 2006


I'm trying to figure out how to work out the URL of a file within a plugin.

For example, I have a plugin dir called "myplugin" with a file called
"myfile.php" within.  I need to determine the absolute URL of the
myfile.php.  The biggest problem I've come across is that the plugin file is
actually run from within /plugins.php, so most of the normal PHP SCRIPT_NAME
etc tags show the plugins.php page.  The only way I've found of finding the
full path is by using __FILE__ but this doesn't work so well for hosts that
use soft mount points to web sites with home directories.

Are there any config or option variables for the root URL of a Wordpress
site or the plugin directories?

Thanks all,

Matt




More information about the wp-hackers mailing list