I have a wordpress site that is close to 10 years old. I recently altered the template files so single posts would display the date they got updated on instead of the date they got published on.
To my surprise, every post that was published or updated before 6 februari 2021 now shows 6 februari 2021 as the_modified_time. The posts that were published or updated after 6 februari 2021 show the correct date.
I retraced my steps and remembered that on 6 februari 2021, after publishing a post, I saw the yoast notification to index a site’s SEO data (14.0 update). I then ran the indexing proces. Everything seemed fine and I forgot about it. This seems to explains the date.
I then went into the actual DB and found that in the table wp_posts, each row still has the correct date (the post_modified field). However, when I went into the wp_yoast_indexable table, there, the rows have the incorrect date (the 6 februari) in the post_modified field.
WordPress site diagnose has been shouting at me for a while that my sql is outdated and I should be using a sql version higher then 5.6. (I’ve been putting this off since I have no clue how to do this or solve problems doing this) I just mention this cause it might have something to do with the indexing proces.
So, here’s my question: how do I fix this. It doesn’t only affect the post date I display to visitors but also the json-ld and the sitemap. Can I rerun the index proces somehow of can I alter some hook? Any ideas?
]]>If I as an admin wants to make small changes in post I do not want to the_modified_time be changed, is it possible?
]]>This tag displays the date (and time) a post was last modified.
But at the end it also says:
Use get_the_modified_date() to retrieve the value.
Going to get_the_modified_date says:
Retrieve the date on which the post was last modified.
So how are they different? And similarly, how are the_modified_time and get_the_modified_time different?
]]>I’m working on a Newspaper theme that uses a dateline block in the header. The block displays the last time content was pubished or updated via the_modified_time.
This causes problems on the 404 page. I receive the following error:
Trying to get property of non-object in /xxxxxxxxx/dev/wp-includes/general-template.php on line 1523
I added a conditional tag around the element that removed it from 404 error pages; however, this does not help when a visitor gets the error when trying to pull up something with the loop (else: nothing found, etc.).
Any advice is appreciated.
Here’s the code:
https://pastebin.com/Jiejtpbj
]]>I am using WordPress as a CMS rather than a blog, and have the following code in “footer.php”:
<?php the_modified_date('Y-m-d H:i:s T'); ?>
This works on the home page, but is blank on all other pages on the website. All of these pages have been modified since creation.
I have also tried…
<?php echo the_modified_date('Y-m-d H:i:s T'); ?>
… (in other words, adding “echo”) and I have also tried using the_modified_time. In all cases, the last modified date is correctly displayed in the footer on the site’s home page, but the place where there should be a date on other pages is blank.
Haven’t seen this inconsistency mentioned anywhere else. Anyone have any idea what I might have done wrong?
Thanks.
Craig
]]>since upgrading to 2.9.2, single posts using the_time()
function are now displaying the_modified_time()
.
On this particular installation, in the Edit Post Screen, the Publication date does not display as the intended (past) date, but displays as the modified date. If I click on the “edit” link, the original post date&time are correctly displayed.
Has something changed with 2.9.2, or do I have a bad installation?
]]>