The big debate, should you remove the dates from your WordPress posts? In my opinion, it depends on the type of website you have. On some websites, it might be best to remove the date after it is 30 days or older.
On my website, I chose to change the WordPress meta to say “last updated on dd-mm-yy”. My website is more of a reference and tutorial site, and almost everything I write is valid for at least 6 or more months (evergreen content). This is a good solution, especially if you rewrite and update your content.
The last thing you want your visitor to see is a published date of 2 years ago and you actually have rewritten everything so that it is fully up to date. The reader might immediately bounce off your site. Don’t get me wrong, we aren’t trying to trick Google here, we are thinking more about the reader.
If you have great content, don’t let it go to waste!
Below are three different routes you could go down.
- Remove Dates on WordPress Posts 30 Days Or Older
- Change WordPress Published Date to Last Updated On Date
- Use Both Published and Modified Dates
1. Remove dates on WordPress posts that are more than 30 days old
Follow the steps below to remove dates on your WordPress posts that are more than 30 days old.
Step 1
First in WordPress you will want to go into your Appearance Editor and locate your single.php file. It might be slightly different depending upon your WordPress theme. I also recommend backing this file up via FTP if you don’t know what you are doing.
Step 2
Locate your H1 title and right below that you should see a time function, similar to this:
<?php the_time('F j Y'); ?>
We are now going to replace that with this:
<span><?php $daysold = (current_time(timestamp) - get_the_time('U') - (get_settings('gmt_offset')))/(24*60*60); if ($daysold < 30 ) {echo date('F j, Y', strtotime($post->post_date)); } ?></span>
Then click on the “Update File” button.
That function will remove the date from WordPress posts that are more than 30 days old. Also note, this will also remove the date from the SERP pages.
2. Change WordPress published date to last updated on date
A second option is to change the WordPress published date to last updated on date instead. This is actually the approach I take on this blog.
Step 1
First in WordPress you will want to go into your Appearance Editor and locate your single.php file. It might be slightly different depending upon your WordPress theme. I also recommend backing this file up via FTP if you don’t know what you are doing.
Step 2
Locate your H1 title and right below that you should see a time function, similar to this:
<?php the_time('F j Y'); ?>
We are now going to replace that with this:
Last updated on <time datetime="<?php the_modified_time('Y-m-d'); ?>"><?php the_modified_time('F jS, Y'); ?></time>
Then click on the “Update File” button. That will result in your post showing looking like this example below – “Last Updated on August 16th, 2017.” You can of course change the format, order, etc.
Also note, this will update the SERP pages with the last updated date instead of the original published date, as they should already be pulling this from your sitemap file.
- If you’re using the GeneratePress theme, you can do this with just a PHP snippet. See the code.
- If you’re using the Genesis Framework, check out this snippet.
3. Use both published and modified dates
This has become quite a controversial topic with some. So I am adding a third option. You could leave the published date, but also add the “last updated on” date. This way readers see both.
It is also recommended to preview your posts in Google’s Structured Data Testing Tool to ensure it is still pulling the correct snippet info for SERPs.
And your done! Hopefully one of those options works for you, I have had great success with it. Also, here is a great case study on the true power of evergreen content. As always feel free to leave your comments below.
Hi Brian,
Earlier we’ve removed the dates from our WordPress posts, but as we have a lot of time sensitive article/benchmark this was not a good option for us so we added the dates back. Btw. great tutorial as always.
Hey Tom,
Ya I think each owner should make up the decision for themselves. In your case it makes sense to probably leave them. Each use case is a little different.
Hi Brian,
Definitely, this amazing post I was looking for. I hope it will act as organic click rate booster.
I’m torn on this. I’ve seen increased traffic removing dates, but it’s never true that 100% of the content is evergreen and I’ve been annoyed enough clicking through results only to find them 4 years old and no longer applicable to the user.
I just make sure to refresh most trafficked posts regularly in an approach similar to your ‘last updated on’.
For some folks, please check your theme options as well. Many themes will also offer the ability to disable dates.
It’s an interesting thought actually: what if there’d be a plugin, with which you could assign a post as ‘evergreen’, which modifies the behavior of how the dates are displayed?
OMG Daan, I think you just came up with a great idea lol. You should make that happen. I would totally use and promote it.
I’ll think about it, @brianleejackson:disqus. I don’t think it’d be too complicated to developed something like this.
I have it setup as follows: I show the date on my frontpage (recent posts), but once the user opens the article, the date is removed. What are your thoughts about that?
Hmm strange. Most themes should be simply using the single.php template. You might have to modify another file as well.
Haha, it wasn’t a mistake! I actually wanted it to look like that, just wanted to know your thoughts about it. Do you think it’s a good idea?
Many people land directly on posts so they won’t see the date at all.
I think whether you date a post or not, should be down to the type of business you are writing for. if I am searching for something that doesn’t change over time, then I think there is no need to have dated the post and it looks stale with an old date on it. Whereas if I am reading a news article or something on web coding, then for sure I need to know what date it was written. Just my thoughts
Hey Una!
I definitely agree, you should only be changing this if you have the type content which is frequently updated. News articles would be a great example of where you shouldn’t do this approach.
Hi Brian,
I think that the “Last updated on” should only appear on modified posts because it makes new articles feel old.
This did not work for me, I tried to change to change it but I could not locate in my single.php file. Very annoying.
Hey Paul!
I see you are using GeneratePress. I have instructions in my GP review on how to do this. https://woorkup.com/generatepress-review/
I already tried that method, it shows only Last Updated by Paularo. There’s no date.
You need to add the CSS snippet that’s in there too :)
Done. I didn’t know where to add the CSS. I added it to customizer – additional CSS and it worked. Thanks, I read your generate press review which made me buy my first theme.
Great, glad it worked. Yes, I just use the customizer now too since they finally added syntax code editing. No need for third-party plugin anymore.
Worked perfectly well on my WordPress website. Thank you for sharing.
Hi, manual removing and wp meta and date remover and other plugins don’t work with urls containing date; dates still are in search result. What to do? I don’t want to change permalinks.
Hey Robert, if you have the date in the URL itself, there is no way to remove this from indexing without changing your permalinks. I would recommend changing permalinks to something shorter as Google prefers short and clean URLs. Just make sure to add 301 redirects for everything.
Hi Brian,
I’m using GeneratePress – I tried your snippet in the snippets plugin you mentioned (thanks, btw) and what I see is this:
Updated:by Jose
Last Updated on October 3, 2018
I’m guessing the ‘Updated by’ and my name are coming from wherever the original pub date line lives.
Where would you add the code if you weren’t using the snippets plugin? I’m wondering if it’s possible to add it to the source file and comment out the text around the original pub date, without that getting overwritten by a future theme update.
Thanks for any help Brian, and thanks for being so giving in this awesome blog!
J
Hi Brian,
my apologies – it works beautifully!
I was using a plugin to display the last updated date, and left it on!
Your workaround it fantastic – thank you!
Jose
Great, glad you got it working!
Hi Brian Jackson,
Your post still is still showing the original published date in Google search ie Nov 18, 2013, instead of the modified date. Why?
Hey Imran,
Great question! So Google will always be the one that decides whether or not to show the “updated date” even if you have the correct code in place. Some of my other posts are showing the newer date just fine. Google is pretty smart now and can tell if content is being regularly updated or is stale.
I use elementor, and I cannot find anywhere information on how to remove post dates. The thing is, that our category is a high ranking landing page (once our current site migrates) and the posts there after are all cases (over 120). We can’t have post dates on them. I wish there was a service to do this. Great article though!