WordPress.org

Make WordPress Core

Opened 12 months ago

Last modified 12 months ago

#24122 new defect (bug)

When opening a file in Plugin Editor, show correct plugin in the dropdown selector

Reported by: Daedalon Owned by:
Milestone: Awaiting Review Priority: normal
Severity: minor Version:
Component: Plugins Keywords: has-patch
Focuses: Cc:

Description

When opening a file in Plugin Editor, the reloaded page shows the first plugin according to alphabetical order in the dropdown next to "Select plugin to edit:". It should default to the plugin the loaded file belongs to.

Steps to reproduce

  1. Open wp-admin/plugin-editor.php
  2. Select any plugin from the "Select plugin to edit:" dropdown except the alphabetically first one, eg. WordPress Beta Tester, and click Select.
  3. The page reloads and WordPress Beta Tester is shown as the default value in the dropdown, as expected.
  4. Click any file under Plugin Files, eg. wordpress-beta-tester/readme.txt

-> The page reloads and shows the file in editor. However, "Select plugin to edit:" doesn't have a value set and shows the first plugin in alphabetical order by default.

-> However, if you chose the main plugin file, eg. wordpress-beta-tester/wp-beta-tester.php, "Select plugin to edit:" shows the correct plugin as the default value.

Any clicked file should lead to its plugin used as the default value for "Select plugin to edit:".

Attachments (1)

24122.patch (553 bytes) - added by aniketpant 12 months ago.
Fixes bug by changing the way the strings were being compared

Download all attachments as: .zip

Change History (4)

aniketpant12 months ago

Fixes bug by changing the way the strings were being compared

comment:1 aniketpant12 months ago

  • Keywords has-patch added

The bug was there because when a file is selected for editing, it passes the filename to $plugin which compares $plugin with the primary file of all plugins to find which plugin the file is a part of.

Fixed the bug by exploding the two strings, and comparing the first elements.

comment:2 SergeyBiryukov12 months ago

#22634 was marked as a duplicate.

Note: See TracTickets for help on using tickets.