[wp-trac] [WordPress Trac] #34358: plugin_dir_url( __FILE__ ) returns plugins directory when plugin symlinked to mu-plugins

WordPress Trac noreply at wordpress.org
Tue Oct 20 03:50:06 UTC 2015


#34358: plugin_dir_url( __FILE__ ) returns plugins directory when plugin symlinked
to mu-plugins
----------------------------+------------------------------
 Reporter:  scamartist26    |       Owner:
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Filesystem API  |     Version:  4.3.1
 Severity:  normal          |  Resolution:
 Keywords:                  |     Focuses:
----------------------------+------------------------------

Comment (by mattmckenny):

 I have confirmed the issue as well. `plugins_ur()` doesn't resolve custom
 paths registered via the wp_register_plugin_realpath() before comparing
 the file path to the mu-plugins path as found here
 https://core.trac.wordpress.org/browser/tags/4.3.1/src/wp-includes/link-
 template.php#L2943.

 My suggested fix extracts the functionality found starting here, through
 line 660, https://core.trac.wordpress.org/browser/tags/4.3.1/src/wp-
 includes/plugin.php#L654, and move it into a new function
 `wp_get_plugin_realname()` . This function is then called in both the
 `plugin_basename()` and `plugins_url()` and allows this file path / mu-
 pluins path comparison to return as expected. Hopefully this
 [https://core.trac.wordpress.org/attachment/ticket/34358/urls_for_symlinked_mu_plugins.34358.diff]
 illustrates the change better than my description.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/34358#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list