Skip to content

Commit db11338

Browse files
committed
Always filter timestamp
1 parent 0ecd843 commit db11338

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

includes/templates/class-amp-post-template.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -302,19 +302,20 @@ private function build_post_data() {
302302
* @return int Post publish UTC timestamp.
303303
*/
304304
private function build_post_publish_timestamp() {
305+
$format = 'U';
306+
305307
if ( empty( $this->post->post_date_gmt ) || '0000-00-00 00:00:00' === $this->post->post_date_gmt ) {
306308
$timestamp = time();
307309
} else {
308-
$format = 'U';
309310
$timestamp = (int) get_post_time( $format, true, $this->post, true );
311+
}
310312

311-
/** This filter is documented in wp-includes/general-template.php. */
312-
$filtered_timestamp = apply_filters( 'get_the_date', $timestamp, $format, $this->post );
313+
/** This filter is documented in wp-includes/general-template.php. */
314+
$filtered_timestamp = apply_filters( 'get_the_date', $timestamp, $format, $this->post );
313315

314-
// Guard against a plugin poorly filtering get_the_date to be something other than a Unix timestamp.
315-
if ( is_int( $filtered_timestamp ) ) {
316-
$timestamp = $filtered_timestamp;
317-
}
316+
// Guard against a plugin poorly filtering get_the_date to be something other than a Unix timestamp.
317+
if ( is_int( $filtered_timestamp ) ) {
318+
$timestamp = $filtered_timestamp;
318319
}
319320

320321
return $timestamp;

0 commit comments

Comments
 (0)