WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 8 days ago

#16953 closed enhancement

Allow symlinked plugins — at Version 5

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 symlinked paths, depending on their environment.

Change History (7)

scribu3 years ago

'pre_plugin_basename' filter

comment:1 scribu3 years ago

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

Test files coming up.

scribu3 years ago

comment:2 scribu3 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 3 years ago by scribu (previous) (diff)

comment:3 scribu3 years ago

  • Description modified (diff)

comment:4 scribu3 years ago

  • Description modified (diff)

comment:5 scribu3 years ago

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