REST API: Add author, modified, and parent sort order options for posts.

These (and a few others that can be revisited later if needed) were present in
beta versions of the WP REST API but were removed during the merge to WP 4.7.

Props ChopinBach, jnylen0.
Fixes #38693.


git-svn-id: https://develop.svn.wordpress.org/trunk@40605 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
James Nylen
2017-05-10 18:51:28 +00:00
parent 93ddc497f0
commit 0fab6c9fdc
5 changed files with 112 additions and 36 deletions

View File

@@ -998,30 +998,4 @@ class Tests_Query_DateQuery extends WP_UnitTestCase {
$expected = array( $p1, $p4, $p5, );
$this->assertEqualSets( $expected, $q->posts );
}
/** Helpers **********************************************************/
/**
* There's no way to change post_modified through the API.
*/
protected function update_post_modified( $post_id, $date ) {
global $wpdb;
return $wpdb->update(
$wpdb->posts,
array(
'post_modified' => $date,
'post_modified_gmt' => $date,
),
array(
'ID' => $post_id,
),
array(
'%s',
'%s',
),
array(
'%d',
)
);
}
}