Do you want to display last updated date for your posts in WordPress? Some websites regularly update their posts and would like to show users when the article was last updated. In this article, we will show you how to easily display the last updated date of your posts in WordPress.
Most WordPress themes usually show the date when a post was last published. This is fine for most blogs and static websites.
However, WordPress is also used by websites where old articles are regularly updated (like ours). This last updated date and time is important information for those publications.
The most common example is news websites. They often update old stories to show new developments, add corrections, or media files. If they only added the published date, then their users would miss those updates.
Many popular blogs and websites don’t show any date on their articles. This is a bad practice and you should never remove dates from your blog posts.
Having said that, let’s see how to easily display last updated date for your posts in WordPress.
This tutorial requires you to add code to your WordPress files. If you haven’t done this before, then we recommend you to look at our guide on how to copy paste code in WordPress.
You will need to add this code to your theme’s functions.php file or a site-specific plugin.
This code checks to see if a post’s published date and last modified dates are different. If they are, then it displays last modified date before the post content.
You can add custom CSS to style the appearance of the last updated date. Here is a little CSS that you can use as starting point:
This is how it looked on our demo website.
This method requires you to edit specific WordPress theme files. Many WordPress themes now use their own template tags which define how these themes show post meta data like date and time.
Some themes also use content templates or template parts to display posts.
Few simpler themes will use single.php, archive.php, and other template files to show content and meta information.
You will be looking for the code responsible for displaying the date and time. You can then either replace that code with the following code, or add it right after your theme’s date and time code.
This is how it looked on our demo site:
We hope this article helped you learn how to display last updated date of your posts in WordPress. You may also want to see our list of most useful time saving WordPress shortcuts.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.