-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Templates API: return post modified datetime in response (#51362)
* All these file changes are so that we can add `modified` to the template and template part objects in the rest response for WP_REST_Templates_Controller For theme templates, it will add the modified value when we have a post id (which is once the template is first save after user change) * Modified property is returned when updated. * Modified property is returned when created. * _wp_build_title_and_description_for_single_post_type_block_template and _wp_build_title_and_description_for_taxonomy_block_template have to be ported across too because they expect WP_Block_Template, not Gutenberg_Block_Template * Revert changes that required pulling all files across and using hooks to add the field to the response. * Now adding the value of `modified` to the response using the get_callback method on the register_rest_field filter, which is the way I should have done it in the first place :) * Formatting date according post_modified rules found in https://developer.wordpress.org/reference/classes/wp_rest_posts_controller/prepare_item_for_response/ * Whoops, forgot to wrap date expectations in mysql_to_rfc3339 * Update lib/compat/wordpress-6.3/rest-api.php Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com> --------- Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com>
- Loading branch information
1 parent
58d9a1b
commit cd234e8
Showing
3 changed files
with
211 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters