Checks the post_date_gmt or modified_gmt and prepare any post or modified date for single post output.
Description
Duplicate of WP_REST_Revisions_Controller::prepare_date_response() .
Parameters
$date_gmtstringrequired- GMT publication time.
$datestring|nulloptional- Local publication time.
Default:
null
Source
if ( rest_is_field_included( 'date_gmt', $fields ) ) {
$data['date_gmt'] = $this->prepare_date_response( $post->post_date_gmt );
}
if ( rest_is_field_included( 'id', $fields ) ) {
$data['id'] = (int) $post->ID;
}
if ( rest_is_field_included( 'modified', $fields ) ) {
$data['modified'] = $this->prepare_date_response( $post->post_modified_gmt, $post->post_modified );
}
Changelog
| Version | Description |
|---|---|
| 6.3.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.