Many WordPress users don’t want the post published date to appear in the SERPs. The reason they don’t prefer to display the published date in Search Engines is because people usually prefer evergreen content. I wanted to remove dates from our website also as our website is a resources website like WordPress Codex. The problem with WordPress is that it by default displays post published dates in posts and in search engine results. After using a plugin to remove the post published date from posts and Search Engines for some time, I preferred to use the last updated date instead. In today’s article I will show you how to replace the published date with the last updated date in WordPress themes and in Genesis child themes.
Why you shouldn’t remove dates from Search Engines and posts?
You may want to remove dates from search engines as I did before, but after reading some articles (including this one from WPBeginner) I decided that removing dates is not a good practice. The reason why removing dates is not a good practice is that when people visit your website and read an outdated entry and they don’t see dates, they would probably not visit your website again if it appeared in the SERPs as they will mark your website content as outdated and useless.
As you can see, we use the last updated date instead of the published date. In this way my website search results will have the last updated date instead of the published date. This method will also prevent Search engines from marking my website content as outdated content. By using the last updated date you will make sure that the date appears in SRPs is always the most recent date. For example, if you wrote a post a year ago and updated it today, it will appear in Google and SERPs as today.
How to display last updated date instead of published date In WordPress?
To display the last updated date in any WordPress theme, add the following code to your WordPress post meta data:
[code]Last updated on <time datetime="<?php the_modified_time(‘Y-m-d’); ?>">
<?php the_modified_time(‘F jS, Y’); ?></time>
How the code works?
The code checks for the last time your post was updated and displays it instead of the published date. If you didn’t update your post after publishing it, the code will display the published date until you update your post.
The lat updated date will be displayed for both visitors and Search Engines, so Search Engines will display your post last updated date instead of published date in the SERPs.
How to display last updated date instead of published date In Genesis Framework & Genesis Child Themes?
At the time of writing this post, this website uses Genesis Framework with some changes. One of those changes is replacing the post published date with the last updated date. If you’re using Genesis Framework or a Genesis child theme follow this guide to replace your post’s published date with last updated date.
To display the last updated date in Genesis, Add this code to your theme functions.php file using any file editor like Notepad++:
That’s all what you need to do!
The code will remove the published date and displays the last updated date in your posts. This will also tricks the Search Engines to use the last updated date instead of published date in SERPs.
If you need any help, don’t hesitate to use comments below!