So many of you are using WordPress for different purposes. Some of you use it for blogging, marketing, personal website and many more. Bloggers will publish some serious contents frequently. As the technology being updated time to time, the articles also to be updated frequently to retain the freshness of them. All set, and you updated the articles. Now, how to notify the users about the update? Placing an ad on the sidebar or creating a link on it is a difficult task that can’t be done every time we update our content.
What is the benefit of displaying the last updated date?
Usually, WordPress will display the published date on posts instead of the last updated date. But there are certain benefits of displaying last updated date –
- It will tell users that the post has been updated recently and includes the latest information.
- Helps SEO of the post by telling search engines that you make sure to keep it updated.
- Improves the authenticity of the website by showing users that you always update old content.
- Encourages users to visit your website again because the content might get updated later.
Methods to display the last updated date in posts
If your articles show the Updated dates on them, it will be very useful for the visitors to determine whether the post is updated or is it an old one. In this tutorial, we are sharing the method to display the last updated Date of Posts in WordPress. Follow the simple methods given below.
Method 1. Use the WordPress Full-Site Editor
The latest versions of WordPress come with a Full-Site Editor. If your theme is compatible with it, you can easily modify your template to display the date with the “Date Block” anywhere you want. In the configuration of that date block, be sure to choose the modified date instead of the published date. You can access the site editor from Appearance > Editor.
Method 2. Using a plugin
A slightly easier way to show the last updated date on WordPress is by using a plugin such as the WP Last Modified Info. Such plugins have a lot of configurable functionality to display the modified date of the posts in any of the content types on your website.
Method 3. By editing the theme files
You can directly edit the theme files and replace the published date with the modified date following these steps –
- Go to your Web disk. You can use an FTP software or cPanel based on the type of hosting.
- Open the root directory of your theme.
- Find The files named index.php, single.php, page.php.
- Locate any of the following code in those files. Note: There may be some slight difference in the code as all of them using different themes which uses different hooks for the Dates. So determine them and find it.
- get_the_date(‘F jS, Y’)
- the_date()
- post_date()
- the_time()
- etc…
- Replace it with the following code –
<?php
$u_time = get_the_time('U');
$u_modified_time = get_the_modified_time('U');
if ($u_modified_time >= $u_time + 86400) {
echo "and last modified on ";
the_modified_time('F jS, Y');
echo " at ";
the_modified_time();
echo ", ";
}
?>
Now you have completed the steps to display the last updated date of posts on WordPress and your posts will start showing the updated dates.
Best Practices
While displaying the last updated date of your posts, make sure of certain things such as –
- The published date should be also visible so that that users can find out when the original article was published. This is crucial for news articles.
- The last update date should also get updated in the Schema of your website, not just on the frontend.
- Do not update your articles just for the sake of showing a newer date. Especially if you are just adding a couple of sentences.
- Before implementing custom functionality, check if your theme already provides the feature. Many modern WordPress themes are bundled with this feature by default.