plugin_basename returns full directory in URL
|Reported by:||damianzaremba||Owned by:|
If a trailing slash is specified on either then WP_PLUGIN_DIR or WPMU_PLUGIN_DIR settings, the plugin_basename function returns the whole directory path in the URL.
The documentation does state not to use a trailing slash, however I think this function could be improved.
By removing the explicit / in the preg_replace the correct plugin name will be returned even if a trailing slash is specified on the WP_PLUGIN_DIR or WPMU_PLUGIN_DIR constants.
This should not affect the relative path as the trim before the return takes care of stripping off the first slash if it exists (effectively duplicating the remove in this case).
While this is a very trivial change that won't affect most people (who read the docs properly) it was quite annoying to track down.
Please see the attached diff.