Skip to content

Query Loop: sorting by A-Z/Z-A ignores numerical order #61650

@liviopv

Description

@liviopv

Description

When sorting a Query Block alphabetically, posts starting with numbers will be sorted based on the first character only [1, 10, 11 (...), 2], without considering its numerical order. I'd expect it to sort posts considering the numerical order as well.

Step-by-step reproduction instructions

  1. Publish a post with the title starting with "1"
  2. Publish a post with the title starting with "2"
    1. Publish a post with the title starting with "10"
  3. Add a Query Loop to a page, sort by A-Z or Z-A
  4. The order will be 1-10-2, instead of 1-2-10.

Screenshots, screen recording, code snippet

CleanShot 2024-05-14 at 12 01 04@2x

Environment info

  • WordPress 6.5.3, GB 18.3

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Block] Query LoopAffects the Query Loop Block[Type] BugAn existing feature does not function as intended[Type] WP Core TicketRequires an upstream change from WordPress. Core Trac ticket should be linked.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions