Many WordPress users don’t want the post publishing date to appear in the SERPs. The reason they don’t prefer to display the published date in Search Engines is that people usually prefer evergreen content.
We 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 publish dates in posts and in search engine results.
After using a plugin to remove the post publish date from posts and Search Engines for some time, we preferred to use the last updated date instead.
In this guide, we 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) we 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 that 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 the last updated date instead of the published date In WordPress?
To display the last updated date in any WordPress theme, add the following code to your WordPress post metadata:
Last updated on <time datetime="<?php the_modified_time(‘Y-m-d’); ?>"> <?php the_modified_time(‘F jS, Y’); ?></time>
How does the code work?
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 last updated date will be displayed for both visitors and Search Engines, so Search Engines will display your post’s last updated date instead of the publish date in the SERPs.
How to display the 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 the last updated date.
To display the last updated date in Genesis posts, Add this code to your theme functions.php file using any file editor like Notepad++:
That’s all that you need to do!
The code will remove the published date and displays the last updated date in your posts. This will also trick the Search Engines to use the last updated date instead of the published date in SERPs.
Add Last Updated Date to WordPress Pages
WordPress pages do not show page publish nor update date by default since they are usually used for evergreen content like homepage, contact us pages, etc.
However, if you ever wanted to show the last updated date on a WordPress page on a website that uses Genesis, simply add the following code to your Genesis child theme’s functions.php file.
If you need any help, don’t hesitate to use the comments below!
Leave a Reply