Home✔Naija HB SpecialHow to Show Last Updated Date of Your Posts In WordPress and...

How to Show Last Updated Date of Your Posts In WordPress and Google

Published on

Displaying the last updated date of your blog posts is highly important, if you want your visitors to know your articles are relevant and up to date.

But most blog posts remain stuck with the actual date they were published. This can be seen in Google Search Results and above or beneath the post title.

Trust me! Most people will not click on your blog posts if they discovered it was published a long time ago.

If you update your blog posts regularly, it is quite unfair to display a date showing 10 years ago, don’t you think?

The hard work you put in to keep your blog post relevant for many years should never go unnoticed.

After all, that is what we, evergreen publishers, aim for. We want our articles to be read even 10 years after we originally published them.

Although, even after hiding your date, there are ways to bypass the hidden date and check the date a post was originally published, most people will not want to go through that stress before reading your post.

This guide will show you how to display last updated date of your blog posts in WordPress and Google Search results — following any of the three methods below.

For a newbie, I advise you…

Display Last Updated date using a WordPress plugin

Download and install a free plugin called ‘post update date.’ You can learn how to install a WordPress plugin from my previous guide.

After installation, the plugin automatically shows the last updated date of your posts, if it is different from the last published date. It can be visible right below the title tag.Post showing both last updated and last modified date

Easy, right?

What I don’t like, though, is that it displays both the published date above and the last updated date below. Many visitors might still doubt the relevance of your blog post.

You can either delete the plugin and follow the steps below to add the code to your website. Or leave the plugin installed and remove the default meta tag so that you will  have just the updated date.

So, if you are ready to play your way around codes, I advise you…

Show last updated date by editing your theme content.php

If you are not very good at css, I advise you backup your theme first before going on. Also, I suggest you use a child theme, so that your settings will not undo when your theme is updated. You can create a child theme using one click child theme plugin.

But before creating a child theme, ensure you take note of the file that contains your default publication date. For twenty seventeen WordPress theme, it can be found in the content.php.

Note:

For other themes, you may locate this file in index.php, single.php or page.php. Depending on your theme maker.

For this tutorial, I will be making use of the default twenty seventeen default WordPress theme.

Make sure /post/content.php is located within your child theme. If it’s not there, then you need to create that file using your ftp/sftp client. In my case, I make use of FileZilla.

theme content.php

If you are not comfortable with creating child themes, then you have to add the code to your theme directly…

Under appearance, click on editor. Make sure your theme is selected, and click on template-parts>>post>>content.php.

click on template parts, post, content.php\

Add the piece of code below to your your theme file to replace your default published date.

[php]$u_time = get_the_time('U');
$u_modified_time = get_the_modified_time('U');
if ($u_modified_time >= $u_time + 86400) {
echo "Last updated on ";
the_modified_time('F jS, Y');
echo ", "; }
else {echo "Posted on "; the_time('F jS, Y');}[/php]

For twenty seventeen WordPress theme, published date is enclosed between the tag echo ‘<div class=”entry-meta”>’; and echo ‘</div><!– .entry-meta –>’; your theme may turnout to be different from this code. Whatever it is, just know you are replacing the default “entry-meta”

The final code in the theme content.php looks like this:

replace default entry meta tag with last modified

How to display last updated date in Google search result pages

Google, by default, picks the date that is displayed under your title tag — if you have enabled search engines to display your post dates in search results.

If you use WordPress SEO plugin by Yoast, you can easily change this settings. Follow this guide to setup Yoast SEO.

In your WordPress dashboard, locate Yoast and click on Search appearance.

Yoast Search Appearance

Select ‘Content Types,’ and under post, make sure Date in Snippet Preview is set at on.

Yoast content type: Show post in Search

Hit the ‘Save Settings’ button when you are done.

I hope with this guide, you were able to display last updated date in your blog posts and in Google Search results.

Have any questions? Feel free to ask using the comment section below.

Don’t forget to connect with us on Facebook, Twitter and YouTube, to get access to exclusive blogging tips faster.

Latest articles

Who is The Tenge Tenge Kid?

Videos of the Tenge Tenge kid have garnered hundreds of millions of views on...

List of Nigerian States with APC Governors

Discover the list of Nigerian States being governed by the All Progressives Congress (APC)...

See the Names and States of PDP Governors in Nigeria in 2023

Get to know the governors leading their states under the People's Democratic Party (PDP)...

Present Governors of All 36 States in Nigeria, Deputies & Parties (2023)

This post provides information on the present governors for all 36 states in Nigeria....

More like this

Who is The Tenge Tenge Kid?

Videos of the Tenge Tenge kid have garnered hundreds of millions of views on...

List of Nigerian States with APC Governors

Discover the list of Nigerian States being governed by the All Progressives Congress (APC)...

See the Names and States of PDP Governors in Nigeria in 2023

Get to know the governors leading their states under the People's Democratic Party (PDP)...