Skip to content

fix: apply the Snippets List Order setting again (3.10.1) - #469

Merged
imantsk merged 2 commits into
corefrom
fix/list-order-release/core
Aug 28, 2026
Merged

fix: apply the Snippets List Order setting again (3.10.1)#469
imantsk merged 2 commits into
corefrom
fix/list-order-release/core

Conversation

@TallblokeUK

@TallblokeUK TallblokeUK commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Targeting core for 3.10.1. Same change as #465, which targets core-beta — whichever suits the release, the other can be closed.

The bug

Reported from support: Settings → Snippets List Order has no effect. Whichever of its five options you pick, the All Snippets table opens in the same order.

Reproduced on two clean installs — WP 7.0.4 / PHP 8.2.33 and WP 7.1 / PHP 8.3.33. Name (Z-A) should invert the list; nothing moved on either.

Cause

The setting is still defined and still rendered, but nothing reads it. Its only two references in 3.10.0:

Settings_Fields.php:91    'list_order' => 'priority-asc',   ← default value
Settings_Fields.php:191   'list_order' => [ … ],            ← the field in Settings

Until 3.10 the list table applied it directly:

// 3.9.2 — class-list-table.php:1311
$order = Settings\get_setting( 'general', 'list_order' );

Sorting moved to the column headings during the admin rewrite. The consumer went with the old table; the setting stayed in the UI, reading nothing.

Approach

The headings are the mechanism now, so this doesn't restore a parallel ordering system. It maps the setting onto the table's opening sort — which is what the setting describes itself as: "Default way to order snippets on the All Snippets admin menu."

  • list_order is localized alongside the other manage data
  • mapped to a column id and direction (priority/name/date, asc/desc)
  • passed to ListTable as a new optional initialSort

Clicking a heading overrides it for the rest of the visit, exactly as it overrides any other starting order. The initialSort prop is optional, so no other ListTable consumer changes behaviour.

On removing it instead: that was the alternative, and it's defensible given headings supersede it. I didn't, because it's a visible feature removal for anyone who has it configured, and the value is carried in saved settings either way — honouring it costs less than taking it away. Easy to flip if you'd rather retire the setting.

Verification

Against a reproduction of the reported environment (WP 7.0.4, PHP 8.2.33, 3.10.0, 190 snippets):

list_order before after
priority-asc Repro 001, 002, 003, 004 Repro 002, 003, 004, 005
name-desc Repro 001, 002, 003, 004 Repro 190, 189, 188, 187

An e2e test covers it and fails without the change. Full suite: 90 Playwright, 157 PHPUnit, 0 failures; lint:js and lint:styles clean.

Manage_Menu_Assets_Test pins the localized key list, so it gains listOrder.

Note

No changelog entry, consistent with #461, #462 and #463.

Fixes #474

"Snippets List Order" in Settings had no effect: whichever of its five
options was chosen, the table opened in the same order.

The setting is still defined and still rendered, but nothing reads it.
Its only two references in the codebase are its default value and its
field definition. Until 3.10 the list table applied it directly, in
`class-list-table.php`:

    $order = Settings\get_setting( 'general', 'list_order' );

Sorting moved to the column headings during the admin rewrite, and the
consumer went with the old table while the setting stayed in the UI.

The headings are the right mechanism now, so rather than restore a
parallel ordering system this maps the setting onto the table's opening
sort, which is what it describes itself as: "Default way to order
snippets on the All Snippets admin menu." `list_order` is localized,
mapped to a column and direction, and passed to `ListTable` as
`initialSort`. Clicking a heading overrides it for the rest of the
visit, exactly as it overrides any other starting order.

Removing the setting was the alternative. It would have been a visible
feature removal for anyone who has it configured, and the option is
carried in saved settings either way, so honouring it costs less than
taking it away.

Verified against a reproduction of the reported environment — WordPress
7.0.4, PHP 8.2.33, 3.10.0, 190 snippets. Before, every option produced
an identical list; after, "Name (Z-A)" inverts it. Covered by an e2e
test that fails without the change.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@imantsk imantsk added the build Adding this label will trigger the zip build action label Aug 28, 2026
@code-snippets-bot

code-snippets-bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Download and install

📦 code-snippets.3.10.0.zip

@imantsk
imantsk merged commit aa5c325 into core Aug 28, 2026
27 checks passed
@imantsk
imantsk deleted the fix/list-order-release/core branch August 28, 2026 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Adding this label will trigger the zip build action run-tests Trigger automated tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants