{"id":7417,"date":"2022-06-10T10:56:17","date_gmt":"2022-06-10T14:56:17","guid":{"rendered":"https:\/\/trustpulse.com\/?p=7417"},"modified":"2022-06-10T10:56:17","modified_gmt":"2022-06-10T14:56:17","slug":"how-to-display-and-change-last-modified-date-in-wordpress-step-by-step","status":"publish","type":"post","link":"https:\/\/trustpulse.com\/2022\/06\/10\/how-to-display-and-change-last-modified-date-in-wordpress-step-by-step\/","title":{"rendered":"How To Display and Change Last Modified Date in WordPress (Step-by-Step)"},"content":{"rendered":"
Do you want to display the last modified date on a post in WordPress?<\/p>\n
You want your content to look fresh and updated even if you wrote it several years ago. Displaying a last modified date can help you climb the search engine rankings and build trust with readers.<\/p>\n
In this tutorial, we’ll teach you how to easily display and change the last modified date of your posts in WordPress.<\/p>\n
Table of Contents:<\/strong><\/p>\n Search engines look for new or recently updated content. So do readers, especially in fast-changing industries like tech or business. If a visitor sees a post written 5 years ago, they\u2019re more likely to leave your site in search of more updated information. Of course, you might be able to catch some of those bounces with exit-intent popups<\/a>. But why not convince them to stay on your site longer in the first place?<\/p>\n One way to do this is to display the last modified date in addition to the publish date. Visitors will see that the content is updated and therefore more reliable.<\/p>\n On the front end, WordPress defaults to the date a post was first published even if you update the post later. To change this publish date, you\u2019d have to republish a post after unpublishing it. We have an easier way!<\/p>\n Let’s look at 2 ways to show the last modified date in WordPress:<\/p>\n What’s the best way to show the last modified date in WordPress?<\/p>\n Method 1 is easier than it sounds. You don\u2019t have to write the code for Method 1 yourself, but you should be comfortable following technical instructions. Furthermore, you won’t need a third-party plugin. This can improve your site load time and reduce compatibility issues.<\/p>\n Method 2 is a perfect solution if you\u2019d rather not mess with any code at all. The plugin makes it easy to configure your last modified date settings. Just remember to choose a plugin that is compatible with your theme, plugins, and WordPress version.<\/p>\n The first method is to add a snippet of code to your functions.php<\/a> file or a site-specific plugin.<\/p>\n Be aware that if you update your theme or change to a different theme, you will lose the added code in your functions.php file. So we like to use a site-specific plugin<\/a>.<\/p>\n Here\u2019s the code you need to add: If you need more help, follow this great step-by-step guide to creating a site specific plugin<\/a>. It’s not as hard as it may sound, we promise!<\/p>\n There are also premade plugins you can use to show the last modified date. Our recommendation is WP Last Modified Info<\/a>, which is free to use and highly rated.<\/p>\n <\/p>\n Here\u2019s how to display last modified info with this plugin.<\/p>\n Step 1: Install the Plugin<\/strong><\/p>\n You can download WP Last Modified Info for free from the WordPress plugin repository. Go to Plugins \u00bb Add New.<\/strong><\/p>\n <\/p>\n Search for WP Last Modified Info and click on Install Now<\/strong>.<\/p>\n <\/p>\n Once you install the plugin, click on Activate.<\/strong><\/p>\n <\/p>\n Step 2: Configure the Last Modified Date<\/strong><\/p>\n From the WordPress dashboard, go to Settings \u00bb WP Last Modified Info.<\/strong><\/p>\n First, toggle on the Enable for Posts\/Pages on Frontend<\/strong> switch. This will start displaying the last modified date on your posts.<\/p>\n <\/p>\n Configure the following settings:<\/p>\n <\/p>\n You will get different settings to configure based on whether you choose traditional or human readable format.<\/p>\n You may also want to modify the copy in the HTML template to fit the format.<\/p>\n Traditional format would look better as:\u00a0Last Updated on [date] by [author]<\/strong><\/p>\n But human readable format would make more sense with something like: Last updated [time elapsed] ago by [author]<\/strong><\/p>\n <\/p>\n Make sure to click Save Settings<\/strong> when you\u2019re done.<\/p>\n Now you will see the last modified date on all of your posts!<\/p>\n Using either of the methods shown above will automatically display the last modified date on your posts.<\/p>\n Sometimes, however, you may not want to change the modified date. For example, if you are just making small proofreading corrections, it could seem misleading to call it an update. If you recategorize older posts, that technically counts as an update. But it’s probably not necessary to show all of those posts as \u201cupdated\u201d just because you changed the post category.<\/p>\n Fortunately, you can \u201cfreeze\u201d the last modified date when making small updates or minor tweaks.<\/p>\n The best SEO plugin AIOSEO<\/a> can not only manage your site\u2019s search rankings, but it can also keep the post modified date from changing.<\/p>\n <\/p>\n To learn more, check out this full AIOSEO review<\/a> and learn how to get started optimizing your content for search<\/a>.<\/p>\n It’s best practice to always display dates on your posts, even if your content is not linked to a specific event or promotion. These days, information changes quickly, and recently updated content is often seen as more credible.<\/p>\n <\/p>\n You change the actual publish dates on a blog post in WordPress. This can be helpful if you need to change the post\u2019s position in your archive pages. Posts can be backdated or scheduled in advance. You can edit the publish date in the Publish settings box on the right-hand side of the WordPress dashboard.<\/p>\n <\/p>\n Now you know how to display and change the last modified date in WordPress.<\/p>\n If you want to get even more visitors to your blog, check out how to create push notifications to drive more traffic<\/a>.<\/p>\n Did you like this article? If so, please follow us on Facebook<\/a> and Twitter<\/a> for more free WordPress tips.<\/p>\n","protected":false},"excerpt":{"rendered":" Do you want to display the last modified date on a post in WordPress? You want your content to look fresh and updated even if you wrote it several years ago. Displaying a last modified date can help you climb the search engine rankings and build trust with readers. In this tutorial, we’ll teach you<\/p>\n","protected":false},"author":32,"featured_media":7434,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"limit_modified_date":"","last_modified_date":"","om_disable_all_campaigns":false,"inline_featured_image":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[10],"tags":[],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/trustpulse.com\/wp-json\/wp\/v2\/posts\/7417"}],"collection":[{"href":"https:\/\/trustpulse.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/trustpulse.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/trustpulse.com\/wp-json\/wp\/v2\/users\/32"}],"replies":[{"embeddable":true,"href":"https:\/\/trustpulse.com\/wp-json\/wp\/v2\/comments?post=7417"}],"version-history":[{"count":8,"href":"https:\/\/trustpulse.com\/wp-json\/wp\/v2\/posts\/7417\/revisions"}],"predecessor-version":[{"id":7692,"href":"https:\/\/trustpulse.com\/wp-json\/wp\/v2\/posts\/7417\/revisions\/7692"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/trustpulse.com\/wp-json\/wp\/v2\/media\/7434"}],"wp:attachment":[{"href":"https:\/\/trustpulse.com\/wp-json\/wp\/v2\/media?parent=7417"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/trustpulse.com\/wp-json\/wp\/v2\/categories?post=7417"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/trustpulse.com\/wp-json\/wp\/v2\/tags?post=7417"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}\n
Displaying the Last Modified WordPress Date<\/h2>\n
\n
<\/span>Method 1: Use Code to Display Last Modified Date<\/span><\/h3>\n
\nfunction wpb_last_updated_date( $content ) {
\n$u_time = get_the_time('U');
\n$u_modified_time = get_the_modified_time('U');
\nif ($u_modified_time >= $u_time + 86400) {
\n$updated_date = get_the_modified_time('F jS, Y');
\n$updated_time = get_the_modified_time('h:i a');
\n$custom_content .= '
\n<p class=\"last-updated\">Last updated on '. $updated_date . ' at '. $updated_time .'<\/p>
\n';
\n}
\n$custom_content .= $content;
\nreturn $custom_content;
\n}
\nadd_filter( 'the_content', 'wpb_last_updated_date' );<\/code><\/p>\n<\/span>Method 2: Use a Plugin to Display Last Modified Date<\/span><\/h3>\n
\n
Changing the Last Modified Date<\/h2>\n
Why You Should You Put Dates on Blog Posts<\/h2>\n
Modifying the Publish Date on a Blog Post<\/h2>\n