How to Add an Old Post Notification to Your WordPress Blog


Do you want to add an old post notification in WordPress?

If you’ve been producing content for a while now, it’s possible that some of your content is outdated.

In this article, we will show you how to easily add an old post notification to your WordPress blog.

Added Old Post Notice to WordPress

Why Add Old Post Notification to WordPress Blog Posts

Content degradation (outdated blog posts) can be a problem for growing WordPress blogs.

Depending on your niche, your content can sometimes become irrelevant, incorrect or inappropriate over time. This can lead to poor user experience, higher bounce rate, and lower search rankings.

Ideally, you would want to edit these articles and update them with more useful, accurate, and up-to-date information.

But that’s not always possible because your site may have too many old articles and you may not have enough resources to update them. In this case, adding an old post notification can be useful for your users.

This will let them know that the content is a bit older, and they should keep that in mind when using the information presented on this page.

Another solution that many blogs use is to simply add the “Last Updated” instead of the post date.

An older article with the date of the last update

That being said, let’s see how you can add the old post notification in WordPress and how to show the last updated date on your posts.

Method 1. Show Old Post Notification Using Plugin

This method is easier and recommended for all users who want to view an old post notification.

First, you need to install and activate the Obsolete DX connect. For more details, see our step-by-step guide on how to install a WordPress plugin.

Upon activation, you must visit the Settings ยป Deprecated page to configure plugin settings.

Deprecated settings

Here you have to choose the period and duration. This is the time after which a message will be considered old by the plugin.

Below you can provide a custom message to display on old messages and enable notification display for all old messages. Don’t worry, you can hide it for specific posts by editing them.

On the settings page, you can also choose post types, notification box colors, and add custom CSS if needed.

Advanced settings for outdated messages

Don’t forget to click the Save Changes button to save your settings.

You can now visit an old article on your website to see the plugin in action.

Old post notification displayed on an article

Hide old post notification on individual posts

Now suppose you have an older article, but it is still accurate, up-to-date, and has great search rankings. You might want to hide the old post notification here.

Likewise, what if you updated an old post with new information. The plugin will continue to show an old post notification because it uses the date the post was published to determine its age.

To fix this, you can edit the post and scroll down to the “Outdated notification” tab under the block editor’s post panel. From there, just uncheck the notification option and save your changes.

Hide old post notification

The plugin will now stop showing old post notifications on that particular post.

Method 2. View the last modified date of your posts

Many WordPress websites display the last modified date of their blog posts. Some also replace the date of publication with the date of the last modification.

The advantage of this method is that it shows users when a post was last updated without showing an old post message.

First, you need to install and activate the Information about the last modification of WP connect. For more details, see our step-by-step guide on how to install a WordPress plugin.

Upon activation, go to Settings ยป Information about the last modification of WP page to configure plugin settings.

Last Modified Parameters

On the settings page, you need to enable the global display of the last modified information toggle. After that, you can choose how you want to display the modified date.

You can override the post date, show it before or after the content, or insert it manually into a post.

Below you will find a bunch of options. If you are unsure, you can leave them as default.

Don’t forget to click the Save Settings button to save your changes.

You can now visit your website to see the latest updated information for all of your blog posts.

Last Updated Notice

The problem with this method is that it will display the date of the last update for all posts, including the most recent posts.

You can set a time interval in the plugin settings. But this gap is only limited to 30 days.

Time interval between published and updated messages

The plugin also provides three blocks that you can manually insert into a post or page to display the latest changed information.

Add last modified information using blocks

You also have the option of using custom CSS to style your last updated date notice. We used the following custom CSS in the screenshots above.

p.post-modified-info {
    background: #fbffd8;
    padding: 10px;
    border: 1px solid orange;
    font-size: small;
    font-weight: bold;
}

Method 3. Add old post notification using code

This method requires you to manually add code to your WordPress theme files. If you haven’t already, check out our guide on how to add custom snippets in WordPress.

Simply copy and paste the following code into your theme’s single.php template.

// Define old post duration to one year
$time_defined_as_old = 60*60*24*365; 

// Check to see if a post is older than a year
if((date('U')-get_the_time('U')) > $time_defined_as_old) {

$lastmodified = get_the_modified_time('U');
$posted = get_the_time('U');

//check if the post was updated after being published
 if ($lastmodified > $posted) {
 
// Display last updated notice
      echo '<p class="old-article-notice">This article was last updated ' . human_time_diff($lastmodified,current_time('U')) . ' ago</p>';   

  } else { 
// Display last published notice 
echo '<p class="old-article-notice">This article was published ' . human_time_diff($posted,current_time( 'U' )). 'ago</p>';

}
}

This code defines old posts as all posts published at least one year ago.

After that, it checks if a message is older than a year. If so, it checks to see if the post was updated after it was posted. Then it displays a review based on those checks.

This is what it looked like on our demo website for old and never updated posts.

Last updated information for old post

This is how it looked like an old post, but it was updated after it was posted.

An old post that is never updated

We customized the old post notification with the following custom CSS.

p.old-article-notice {
    background: #fbffd8;
    padding: 10px;
    border: 1px solid orange;
    font-size: small;
    font-weight: bold;
}

We hope this article helped you learn how to easily view old post notifications on your WordPress blog. You can also check out our WordPress SEO guide or check out our pick of the best popular post plugins for WordPress.

If you liked this article, subscribe to our Youtube channel for WordPress video tutorials. You can also find us on Twitter and Facebook.



Leave a Comment

Your email address will not be published.