Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#34473 closed defect (bug) (fixed)

Wrong default order for pages list table in 4.4

Reported by: szaqal21 Owned by: SergeyBiryukov
Priority: normal Milestone: 4.4
Component: Posts, Post Types Version: 4.4
Severity: normal Keywords: has-patch
Cc: Focuses: administration

Description

Default order of pages list table in 4.4 is "date". I've investigated source and found that this is caused by function wp_edit_posts_query():

if ( isset( $q['orderby'] ) ) {
		$orderby = $q['orderby'];
	} elseif ( isset( $q['post_status'] ) && in_array( $q['post_status'], array( 'pending', 'draft' ) ) ) {
		$orderby = 'modified';
	} else {
		$orderby = 'date';
	}
}

else statement is causing this problem:

else {
	$orderby = 'date';
}

it wasn't present in 4.3.

Attachments (1)

34473-wrong-default-order-for-pages.diff​ (500 bytes ) - added by ellie.roepken 11 years ago.
Check that the post type is hierarchical before assuming posts should be listed by date.

Download all attachments as: .zip

Change History (6)

#1 @SergeyBiryukov
11 years ago

  • Milestone Awaiting Review → 4.4

Introduced in [34728].

#2 @SergeyBiryukov
11 years ago

  • Version → trunk

@ellie.roepken
11 years ago

Check that the post type is hierarchical before assuming posts should be listed by date.

#3 @afercia
11 years ago

  • Keywords has-patch added

#4 @SergeyBiryukov
11 years ago

  • Owner set to SergeyBiryukov
  • Status new → reviewing

There's a block for hierarchical post types in line 1048​, which never runs after [34728], because $orderby is always set now.

34473-wrong-default-order-for-pages.diff​ looks good. No need to check if $post_type is set though, it's set above.

#5 @SergeyBiryukov
11 years ago

  • Resolution → fixed
  • Status reviewing → closed

In 35482:

Post List Table: Hierarchical post types should not default to sorting by date.

Regression introduced in [34728].

Props ellie.roepken.
Fixes #34473. See #25493.

Note: See TracTickets for help on using tickets.