Table of Contents
One of the best ways to keep your website content fresh and relevant is by regularly updating your posts and pages. This not only helps to improve the user experience, but it also shows search engines that your website is actively maintained and relevant. One way to visually communicate to your website visitors that you are actively updating your content is by displaying the last updated date on your WordPress posts and pages. In this article, we will discuss how to show the last updated date on WordPress posts and pages, as well as some tips and best practices for doing so.
Why Display the Last Updated Date on WordPress?
There are several reasons why you might want to display the last updated date on your WordPress posts and pages. Some of the main benefits include:
- Improved user experience: By displaying the last updated date, you can give your website visitors a better understanding of when the content was last updated. This can be particularly useful for websites that regularly publish new content, as it helps to give readers an idea of when they can expect to see new updates.
- Improved search engine optimization (SEO): Displaying the last updated date can also be beneficial for SEO. When search engines crawl your website, they look for signals that indicate whether or not your content is up-to-date. By displaying the last updated date, you can show search engines that your content is actively maintained, which can help to improve your ranking in search results.
- Improved credibility: Showing the last updated date can also help to improve the credibility of your website. By regularly updating your content, you can show your website visitors that you are committed to providing accurate and up-to-date information. This can help to build trust with your audience and increase the likelihood that they will return to your website in the future.
How to Display the Last Updated Date on WordPress Posts and Pages
There are several ways to display the last updated date on your WordPress posts and pages. In this section, we will discuss three different methods:
Using a Plugin
One of the easiest ways to display the last updated date on your WordPress posts and pages is by using a plugin. There are several plugins available that allow you to easily add the last updated date to your posts and pages. Some popular options include:
To use one of these plugins, simply install and activate it on your WordPress website. Once activated, the plugin will automatically add the last updated date to your posts and pages. You can then customize the appearance and location of the last updated date using the plugin’s settings.
Using Code
If you prefer to not use a plugin, you can also display the last updated date on your WordPress posts and pages using code. To do this, you will need to add a function to your WordPress theme‘s functions.php file.
Here is an example function that you can use to display the last updated date:
function wpdocs_last_updated_date() {
$content_post = get_post();
$last_updated = get_post_modified_time('F j, Y', false, $content_post, false);
$output = '<p class="last-updated">Last updated on ' . $last_updated . '</p>';
return $output;
}
To use this function, simply add it to your functions.php file and save the changes. Once added, you can then call the function wherever you want to display the last updated date on your posts and pages. For example, you can add the following code to your single.php file (or wherever you want to display the last updated date on your single post pages):
<?php echo wpdocs_last_updated_date(); ?>
You can also customize the appearance of the last updated date by adding your own CSS styles to the “last-updated” class in your theme’s style.css file.
Using the WordPress Block Editor
Now that you know how to display the last updated date on your WordPress posts and pages, here are a few tips and best practices to keep in mind:
- Regularly update your content: One of the most important things to keep in mind when displaying the last updated date is to make sure that you are regularly updating your content. If you are not actively updating your content, the last updated date may not be particularly useful to your website visitors.
- Choose the right format: When displaying the last updated date, it’s important to choose a format that is easy for your website visitors to understand. For example, using a date and time format like “January 1, 2020 at 12:00 PM” may be more confusing than using a simpler format like “January 1, 2020”.
- Use the right placement: Where you place the last updated date on your posts and pages can also be important. You want to make sure that the last updated date is visible to your website visitors, but not so prominent that it distracts from the rest of your content. A good rule of thumb is to place the last updated date at the end of your post or page, or in the footer.
- Customize the appearance: Finally, don’t be afraid to customize the appearance of the last updated date to match your website’s branding. By using your own CSS styles, you can change the font, color, size, and other visual aspects of the last updated date to better fit in with your website design.
Conclusion
Displaying the last updated date on your WordPress posts and pages can be a simple yet effective way to improve the user experience, SEO, and credibility of your website. Whether you choose to use a plugin, code, or the WordPress block editor, there are several options available for adding the last updated date to your website. Just be sure to regularly update your content, choose the right format, use the right placement, and customize the appearance to get the most benefit from displaying the last updated date.