human_time_diff() returns "48 years ago" for all comments (ok)
https://wordpress.stackexchange.com/questions/278040/human-time-diff-returns-48-years-ago-for-all-comments
$args = array(
'number' => '4',
'post_id' => $id, // use post_id, not post_ID
);
$comments = get_comments( $args );
foreach ( $comments as $comment ) :
// get the comments contents
echo $comment->comment_content;
// human readable time when it was posted
//
// this is where we get the "48 years" as when it was posted
//
echo human_time_diff( echo human_time_diff( strtotime( $comment->comment_date ), current_time( 'timestamp', 1 ) );, current_time( 'timestamp', 1 ) );
endforeach;

PreviousCách sử dụng i18n làm multiple language javascript (ok)NextPlugin Category Order and Taxonomy Terms Order (ok)
Last updated
Was this helpful?