Skip to content

Commit

Permalink
Merge pull request #3998 from 10up/fix/issue-3971
Browse files Browse the repository at this point in the history
Fix deprecation warning in strtotime()
  • Loading branch information
felipeelia authored Nov 7, 2024
2 parents 9769a5b + 13e5f68 commit d57b135
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions includes/classes/Indexable/Post/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ function_exists( 'WC' ) ? 'woocommerce_thumbnail' : 'thumbnail',
/**
* Prepare date terms to send to ES.
*
* @param string $date_to_prepare Post date
* @param null|string $date_to_prepare Post date
* @since 0.1.4
* @return array
*/
Expand All @@ -618,7 +618,7 @@ public function prepare_date_terms( $date_to_prepare ) {

// Combine all the date term formats and perform one single call to date_i18n() for performance.
$date_format = implode( '||', array_values( $terms_to_prepare ) );
$combined_dates = explode( '||', date_i18n( $date_format, strtotime( $date_to_prepare ) ) );
$combined_dates = explode( '||', date_i18n( $date_format, strtotime( (string) $date_to_prepare ) ) );

// Then split up the results for individual indexing.
$date_terms = [];
Expand Down

0 comments on commit d57b135

Please # to comment.