mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Posts, Post Types: Reinstate missing sort_column options in get_pages().
This fixes an issue introduced in [55569] that broke sort ordering by `post_modified_gmt` or `modified_gmt`. Props david.binda, azaozz, spacedmonkey, flixos90, joemcgill. Fixes #59226. git-svn-id: https://develop.svn.wordpress.org/trunk@56490 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1181,4 +1181,35 @@ class Tests_Post_GetPages extends WP_UnitTestCase {
|
||||
'Check that ORDER is post date.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that the legacy `post_modified_gmt` orderby values are translated to the proper `WP_Query` values.
|
||||
*
|
||||
* @ticket 59226
|
||||
*/
|
||||
public function test_get_pages_order_by_post_modified_gmt() {
|
||||
global $wpdb;
|
||||
|
||||
get_pages(
|
||||
array(
|
||||
'sort_column' => 'post_modified_gmt',
|
||||
)
|
||||
);
|
||||
$this->assertStringContainsString(
|
||||
"ORDER BY $wpdb->posts.post_modified ASC",
|
||||
$wpdb->last_query,
|
||||
'Check that ORDER is post modified when using post_modified_gmt.'
|
||||
);
|
||||
|
||||
get_pages(
|
||||
array(
|
||||
'sort_column' => 'modified_gmt',
|
||||
)
|
||||
);
|
||||
$this->assertStringContainsString(
|
||||
"ORDER BY $wpdb->posts.post_modified ASC",
|
||||
$wpdb->last_query,
|
||||
'Check that ORDER is post modified when using modified_gmt.'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user