-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Templates API: return post modified datetime in response #4613
Templates API: return post modified datetime in response #4613
Conversation
src/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php
Outdated
Show resolved
Hide resolved
…troller.php Co-authored-by: Andrew Serong <[email protected]>
…even for file-based templates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ramonjd, Left some feedback.
@@ -926,6 +935,13 @@ public function get_item_schema() { | |||
'type' => 'integer', | |||
'context' => array( 'view', 'edit', 'embed' ), | |||
), | |||
'modified' => array( | |||
'description' => __( "The date the template was last modified, in the site's timezone." ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'description' => __( "The date the template was last modified, in the site's timezone." ), | |
'description' => __( 'The date the template was last modified, in the site's timezone.' ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The double quote are there because of the single quotes in site's
. I can update the language to avoid the apostrophe if you think it's better.
I copied it from WP_REST_Posts_Controller
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohh leave it then or you can update like below.
__( 'The date the template was last modified, in the site\'s timezone.' )
src/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…lt_from_post The wrong object was used in the template part assertion. This commit corrects that.
Sorry @tellthemachines and @TimothyBJacobs I just realized I added a breaking change to PHP unit tests on this line: It'll cause the tests to fail sometimes (when they don't run fast enough 😄 ) Fix here: |
Adding 'modified' field and value (if available) to template rest APIcontroller
Synching Core with:
Trac ticket: https://core.trac.wordpress.org/ticket/58540
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.