WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#28214 closed enhancement (fixed)

Allow WP_Query to orderby post_type

Reported by: DeBAAT Owned by: wonderboymusic
Milestone: 4.0 Priority: normal
Severity: normal Version: 4.0
Component: Query Keywords: has-patch
Focuses: ui Cc:

Description

With the introduction of Custom Post Types, the need arose to filter and sort on the post_type.
Filtering is already included in WP_Query, orderby however is not.
This enhancement request suggest to include this option in the query.php file.
The attached patch file only adds 8 characters to support this enhancement.
When the patch is implemented, WP_Query supports:

set_query_var('orderby','type');

Attachments (1)

Ticket #28214.patch (663 bytes) - added by DeBAAT 6 years ago.
Patch for query.php for Ticket #28214

Download all attachments as: .zip

Change History (5)

@DeBAAT
6 years ago

Patch for query.php for Ticket #28214

#1 @DeBAAT
6 years ago

Support for testing the patch for this ticket is appreciated.

#2 @wonderboymusic
6 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 4.0

sure why not

#3 @wonderboymusic
6 years ago

  • Owner set to wonderboymusic
  • Resolution set to fixed
  • Status changed from new to closed

In 28605:

Allow users to sort posts by type in WP_Query.

Props DeBAAT.
Fixes #28214.

#4 @ramiy
6 years ago

i updated the codex.

Note: See TracTickets for help on using tickets.