• I’m using the following code in my comment display list, to show the human time difference.

    <?php echo human_time_diff( get_comment_time('U'), current_time('timestamp') ) . ' ago'; ?>

    When I post a comment and the page refreshes, I expect it to display ‘1 minute ago’ but instead it is displaying ‘1 hour ago’.

    This is not the behaviour I expect, and suspect this isn’t the intended behaviour.

    Can anybody suggest why this might be the case?

Viewing 1 replies (of 1 total)
  • The record shows that there have been some changes in this function, so your result will depend upon which version of WordPress you are using.

    In file: /wp-includes/formatting.php you will find the function: human_time_diff

    And it seems that for time intervals less than an hour, it will say x minutes ago.

Viewing 1 replies (of 1 total)
  • The topic ‘human time diff is wrong’ is closed to new replies.