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

@@ -868,4 +868,28 @@ class WP_UnitTestCase extends PHPUnit_Framework_TestCase {
wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) );
return $id;
}
/**
* There's no way to change post_modified through WP functions.
*/
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',
)
);
}
}