timestamp – the_modified_time showing wrong date


I have an wordpress self-hosted installation that is over 10 years old. I was updating the template files to show the last modified date instead of the published date for my posts.

Old snippet: <time datetime="<?php the_time('c');?>"> <?php the_time('j F Y'); ?></time>

New snippet: <time datetime="<?php the_modified_time('c');?>"><?php the_modified_time('j F Y'); ?>

Here’s where it got weird. Every post that was modified before 6 februari 2021 shows the date 6 februari 2021. Every post that got updated after 6 februari 2021 shows the correct date.

I double checked this. There are posts that haven’t been updated since 2014 or 2011, yet they show 6 februari 2021. I even went into phpMyAdmin and the post_modified field shows the correct date (not 6 februari 2021).

Does anyone have an idea what it causing this or how to fix this? I have some suspects:

  • I’m using older php version: 7.2.34
  • I’m using an old sql server (WP site diagnose says so)
  • I vagely remember doing a sort of database update. Yoast SEO promted me to do something for indexing purposes.
Peter-L 5 months 2021-06-20T13:14:56-05:00 0 Answers 0 views 0

Leave an answer