Make WordPress Core

Opened 19 months ago

Last modified 4 weeks ago

#61752 new enhancement

Plugin and theme editors should show files in alpha order

Reported by: helgatheviking's profile helgatheviking Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch needs-unit-tests has-test-info
Focuses: Cc:

Description (last modified by sabernhardt)

Plugin editor file order

I've been informed this is supposedly "Date created" order. But in my opinion that's not very practical for navigating files.

I would prefer to see the folders in alpha order and then the files in alpha order.

Attachments (4)

9JSQ1U.png (69.6 KB) - added by sabernhardt 19 months ago.
Plugin editor file order
61752.patch (1018 bytes) - added by iflairwebtechnologies 18 months ago.
61752-alpha-file-order.patch (937 bytes) - added by iflairwebtechnologies 5 weeks ago.
New patch generate for 61752-alpha-file-order
plugin-theme-editor-alpha-order.patch (2.0 KB) - added by iflairwebtechnologies 5 weeks ago.
Editor: Sort theme and plugin editor files alphabetically by filename

Download all attachments as: .zip

Change History (15)

#1 @sabernhardt
19 months ago

  • Description modified (diff)

@sabernhardt
19 months ago

Plugin editor file order

This ticket was mentioned in PR #7161 on WordPress/wordpress-develop by @iflairwebtechnologies.


18 months ago
#2

  • Keywords has-patch added

#3 @iflairwebtechnologies
18 months ago

Hello @helgatheviking
We have add change in code so we can see alpha order in plugin file and theme file

Attachment :-
https://tinyurl.com/2y2vxzwg
https://tinyurl.com/2d5h62g9

Last edited 18 months ago by iflairwebtechnologies (previous) (diff)

#4 @helgatheviking
18 months ago

That's a huge improvement! Would it be too much to ask that

  1. All folders are alpha sorted and then all files...

Folder A/
Folder B/
a-file.php
b-file.php

  1. files like Theme Functions are displayed by their actual file name.

comments.php (Comments)
footer.php (Theme Footers)
functions.php (Theme Functions)

instead of

Comments (comments.php)
Theme Footer (footer.php)
Theme Functions (functions.php)

Though I think they might be getting sorted by their file, I am always looking for functions.php and never for Theme Functions. It may matter less with actual alpha sorting, but I think it would be a nice touch to make this area more usable. (Might be entirely out of scope for this ticket though)

#5 @iflairwebtechnologies
5 weeks ago

Thanks for the feedback.
I agree that folders should be listed first (alphabetically), followed by files (alphabetically).

To keep the scope minimal, I’m happy to limit this ticket to basic alphabetical ordering only, without changing display labels (e.g., “Theme Functions”).

I can update the patch accordingly. Please let me know if that direction works.

@iflairwebtechnologies
5 weeks ago

New patch generate for 61752-alpha-file-order

#6 @iflairwebtechnologies
5 weeks ago

  • Keywords needs-testing needs-unit-tests added

Updated patch to sort folders first and files second, both alphabetically.
No label or UI changes included to keep scope minimal.

#7 @helgatheviking
5 weeks ago

Cool! Nice improvement. Will the files all be sorted by their name and not their label? If so, I think it's fine to handle reversing label in another patch. But at the same time,

Theme Functions (functions.php)
to
functions.php (Theme Functions)

does fit it with alphabetizing in my opinion.

#8 @iflairwebtechnologies
5 weeks ago

Thanks! Yes — the sorting is based strictly on the actual filenames and directory names, not on their display labels. The goal of this patch is to improve consistency and predictability by alphabetizing entries without altering existing labels or UI text.

I agree that reversing the label format (e.g. functions.php (Theme Functions)) could better align with alphabetization, but that would be a UI/UX change and feels better suited for a separate follow-up patch to keep this change focused.

@iflairwebtechnologies
5 weeks ago

Editor: Sort theme and plugin editor files alphabetically by filename

#9 @iflairwebtechnologies
5 weeks ago

This patch alphabetizes the theme and plugin editor file lists based on actual filenames for consistent ordering. UI labels remain unchanged.

Version 0, edited 5 weeks ago by iflairwebtechnologies (next)

#10 @huzaifaalmesbah
4 weeks ago

Test Report

Patch tested: https://core.trac.wordpress.org/attachment/ticket/61752/plugin-theme-editor-alpha-order.patch

Steps to Reproduce or Test

  1. Navigate to Tools in the WordPress admin dashboard.
  2. Open Theme File Editor and Plugin File Editor.
  3. 🐞 Observe that the files are not sorted alphabetically.

Expected Results

  • ✅ Files should be displayed in alphabetical order.

Environment

  • WordPress: 7.0-alpha-61215-src
  • PHP: 8.2.29
  • Server: nginx/1.29.4
  • Database: mysqli (Server: 8.4.7 / Client: mysqlnd 8.2.29)
  • Browser: Chrome 143.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty-Five 1.4
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.2.1

Actual Results

Before applying the patch

  • ❌ Files were not sorted alphabetically.

After applying the bugfix patch

  • ✅ Issue resolved. Files are now displayed in alphabetical order.

Screenshots

Before Apply Patch After Apply Patch ✅
https://i.ibb.co/7x8yZQ8J/Huzaifa-20260114085630.png https://i.ibb.co/CGbbCMF/Huzaifa-20260114085937.png
https://i.ibb.co/ZR5YZyN2/Huzaifa-20260114085709.png https://i.ibb.co/QF435DnG/Huzaifa-20260114085921.png

#11 @SirLouen
4 weeks ago

  • Keywords has-test-info added; needs-testing removed
Note: See TracTickets for help on using tickets.