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

WordPress Trac noreply at wordpress.org
Mon Oct 19 17:53:02 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          |   Keywords:
  Focuses:                  |
----------------------------+-----------------------------
 With a plugin symlinked to the mu-plugins folder, paths to find assets via
 the URL are broken if using `plugin_dir_url()`. This does not happen when
 using the `WPMU_PLUGIN_URL` constant. However, if using the constant then
 the plugin is not portable to the normal `plugins` directory without
 additional checks.

 {{{#!php
 <?php

 /**
 * Plugin is symlinked to mu-plugins directory
 */

 // http://example.com/wp-content/plugins/my-plugin-dir/
 define( 'BAD_PLUGIN_URL', plugin_dir_url( __FILE__ ) );

 // http://example.com/wp-content/mu-plugins/my-plugin-dir/
 define( 'GOOD_PLUGIN_URL', WPMU_PLUGIN_URL . '/my-plugin-dir/' );

 }}}

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


More information about the wp-trac mailing list