Why Use the Updated/Modified Date?
Recently, I was looking for ways to replace the published date on posts with the updated date. “Why would you want to do this?”, you might ask. Well, primarily it’s because I make a lot of updates to post content and I want readers to know that the content they are reading is current and relevant. Diplaying an “Updated on…” date will convey exactly what I want my readers to know. If I were to leave the “Published on…” date, the post would only ever display that date. Therefore, if I post something today and come back in a year to update it, readers will initially think that the content is a year old and possibly outdated when it was just updated.
Another big reason for using the updated/modified date instead of the published date is for search engine appearances. When you find a blog article in Google, there’s typically a date right there for you to see when the published date was. Personally, I consider this date pretty heavily before clicking on a Google search result, especially if it’s WordPress or tech related since this type of content is rapidly changing. If I strongly consider the date of a blog article before clicking, others will too. Since I blog about WordPress and web-related technology, I want to make sure my current and potential readers know that the content they are about to click on is up to date.
Displaying the Updated date using Genesis Framework
The following snippet, specific for the Genesis Framework, is what I use on this website to show the last updated date when I edit a post in any proceeding month after is it published. It also includes schema.org micro data for better search engine performance.
One thing to note about the code is that, since it’s my exact code, I decided not to show the updates date if the date is the same month and year as the publish date. The reason for this is because I frequently update newly published posts to fix typos and grammar errors so most of my posts would show as updated a day or two after they were originally published, which I’m not a big fan of. This boils down to a matter of preference so, if you prefer to do something different, you can just modify the code.
Rajasheeraz says
Thank you for solve problem.
Jitendra Mahato says
Thank you, friend. I was searching such code that will help me. I got here in your post. I think it will work now. I have pasted these all code in function PHP. Date is removed from the single post in my blog. Let’s hope some days for google results.
Kristie Hill says
Hi, Ren. I’m using the Genesis simple scripts plugin and the shortcode [post_modified_date]. Do you know if this is doing the same thing, or is just visual and not actually telling Google it’s been updated?
Tyring to decide if I should disable the plugin and go this route instead.
Erik says
Hi,
Is it possible to integrate reading time into your script? Maybe something like https://wordpress.org/plugins/estimated-post-reading-time/ could be used.
Any idea how to integrate this into your function?
Would be really grateful.
Ren says
You could use
do_shortcode( '[shortcode_here]' );
and place it wherever in the code, according to how you want to display it.Erik says
Thanks Ren,
I tried but stumbled on a problem every time. So, I wanted to show est. reading time just after the Author name.
I thought that by doing adding shortcode at the end of the following script I would show the reading time just after the author name: $post_info = sprintf( ‘ Published: %s %s’, get_the_date( ‘Y-m-d’ ), get_the_date(), $author_link ); do_shortcode( ‘[est_time]’ );
But I was soooo wrong. If I add shortcode like above, just at the end, nothing happens, but If I remove ; after $author_link ) and replace it with , so that I can add the shortcode at the and, website throws an error about functions file.
Is there a simple way to add shortcode somehow at the end of your script so that reading time would be shown just after the author name?
Ren says
Give this a shot
Erik says
Thanks Ren,
I opened the link, but all I see is an empty form with the message: Sorry, there is no pastie #10517257 or it has been removed
Ren says
Hmm. I’m not sure why that would have happened. I added it to a gist instead. https://gist.github.com/renventura/42ac661e810f75bcf88f
Erik says
Thank you so much Ren! It works.
Aditya Nath Jha says
I loved the estimated time function thing, but it’s showing up on homepage too and I just want to show it on post pages, can that be done?
Ren says
Wrap it in a conditional for
is_singular('post')
.Rajesh says
thanks a ton this worked for me, if you mind my next question is how to show full URL of my genesis blog in Google SERP results…
Ren says
Hi, Rajesh. This post could use a bit of updating. The search results don’t look like they do in the image I used here. I’ll make a point to update is soon. Google has changed quite a bit about how they display those links. I suggest using Google Webmaster Tools to fetch a post of yours to see how it displays.
Arafin Shaon says
Hi there I’m just facing a wired problem 🙁 My 2 posts updated date is not showing just showing its published date instead of updated.
Waiting for your response.
Thanks
Erik says
Hi Ren,
Thanks for the snippet.
Unfortunately, it doesn’t work on my end.
I have a genesis, News PRO theme, have pasted exact code to functions.php (without: <?php)
and date remains in the same format.
Any ideas what I am missing here?
Rudd says
Thanks, it works beautifully. However, you might also want to add the schema.org markup to it.
Mike says
That would be helpful…anyone have an idea of putting Last Modified schema into this code?
Ren says
I updated the post and changed the code to what I use on this website, which includes schema snippets.
Jason says
Hi Ren. I just wanted to say thank you for this article. I’m also using the Genesis Framework and I just added the source code you have shown to the functions.php file on my website. It works perfectly.
Thanks, and have a blessed day 🙂
Ren says
Thanks, Jason. I’m glad it helped! 🙂
Gaurav Gupta says
Thanks Ren , here my problem solved . Should i fetch the Updated article again in google webmaster tools ?