Skip to content

Commit

Permalink
Coding Standards: Silence a WPCS warning in date_i18n().
Browse files Browse the repository at this point in the history
This fixes a "Calling `current_time()` with a `$type` of `timestamp` or `U` is strongly discouraged as it will not return a Unix (UTC) timestamp" warning.

Props jrf.
See #53359.

git-svn-id: https://develop.svn.wordpress.org/trunk@51557 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
SergeyBiryukov committed Aug 5, 2021
1 parent a6bb6ef commit 16848d5
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/wp-includes/functions.php
Expand Up @@ -167,6 +167,7 @@ function date_i18n( $format, $timestamp_with_offset = false, $gmt = false ) {

// If timestamp is omitted it should be current time (summed with offset, unless `$gmt` is true).
if ( ! is_numeric( $timestamp ) ) {
// phpcs:ignore WordPress.DateTime.CurrentTimeTimestamp.Requested
$timestamp = current_time( 'timestamp', $gmt );
}

Expand Down

0 comments on commit 16848d5

Please sign in to comment.