Make WordPress Core

Opened 9 years ago

Last modified 6 years ago

#16953 closed enhancement

Allow symlinked plugins — at Version 3

Reported by: scribu Owned by: scribu
Milestone: 3.9 Priority: normal
Severity: normal Version:
Component: Plugins Keywords: needs-patch
Focuses: Cc:

Description (last modified by scribu)

There are many scenarios where one would like to have a plugin's folder symlinked to another location.

A couple of these scenarios are described in #13550.

However, when using symlinks, code such as this fails:

plugins_url( 'script.js', __FILE__ );

This happens because __FILE__ resolves to the real path, which confuses plugin_basename().

The most simple and most flexible solution is to add a filter to plugin_basename(), leaving individual devs to handle symlinks, depending on their environment.

Change History (5)

9 years ago

'pre_plugin_basename' filter

#1 @scribu
9 years ago

  • Keywords has-patch added
  • Owner set to scribu
  • Status changed from new to accepted

Test files coming up.

9 years ago

#2 @scribu
9 years ago

  • Description modified (diff)
  • Keywords commit added
  • Milestone changed from Awaiting Review to 3.2

To test:

  1. Extract test.zip into a wp root directory
  2. Activate Test Plugin

The archive already contains a symlink, so it probably won't work on Windows out of the box.

Last edited 9 years ago by scribu (previous) (diff)

#3 @scribu
9 years ago

  • Description modified (diff)
Note: See TracTickets for help on using tickets.