[wp-hackers] plugin_dir_url() and symlinked plugins

Jan Fabry jan.fabry at monkeyman.be
Wed May 18 05:54:26 UTC 2011


On Tuesday, May 17, 2011 4:48:48 PM UTC+2, John Blackbourn wrote:
>
> Does anyone know of a method of determining a plugin's URL that
> supports symlinks?
>
We recently discussed some methods at the WordPress Stack Exchange: 
[ http://wordpress.stackexchange.com/questions/15202/plugins-in-symlinked-directories 
]. When your plugin file is included, the path to the include file exists in 
the variable $plugin (or $mu_plugin or $network_plugin). You can save this 
in your own global variable to use it later in plugin_dir_url() and related 
functions.

$monkeyman_Rewrite_Analyzer_file = __FILE__;
if ( isset( $mu_plugin ) ) {
    $monkeyman_Rewrite_Analyzer_file = $mu_plugin;
}
if ( isset( $network_plugin ) ) {
    $monkeyman_Rewrite_Analyzer_file = $network_plugin;
}
if ( isset( $plugin ) ) {
    $monkeyman_Rewrite_Analyzer_file = $plugin;
}

Other suggestions are of course welcome - here and on the WPSE question!

Greetings,

Jan Fabry


More information about the wp-hackers mailing list