Hello, everybody! It’s less than a week to the end of the year. If in your WordPress blog you use the entry of the year 2021 in <title>, <h1> tags, meta-description, or right in the content, it is time to update the information and replace the year with 2022. This post will be useful if you do not use automation tools. After using the following techniques once, at the end of next year you will not have to repeat them – the year will be updated automatically!
Year Update in <title> and meta-description
Usually the All in One SEO plugin or the Yoast SEO plugin are used for SEO needs in WordPress. If you utilize one of these plugins, I have great news for you – they support variables and, having updated data once, you won’t need to do it again!
Check your site and replace the 2021 entry in <title> and meta-description with the variables:
- For All in One SEO: #current_year
- For Yoast SEO: %%currentyear%%
If this variable is inserted, it is automatically transformed into:

What should you do if you have another plugin that doesn’t support variables? Think well about whether you really need it! The All in One SEO and Yoast SEO plugins have powerful functionality and I recommend using one of them!
Year update in post titles and content
When I first faced this task, I didn’t manage to find a ready-made solution. Maybe there are plugins that solve this problem, but I suggest the following variant. Add the following code in the functions.php file:
function block_year_h1($title){
return do_shortcode($title);
}
add_filter('the_title', 'block_year_h1');
function block_year_body() {
$year = date('Y');
return $year;
}
add_shortcode('year', 'block_year_body');
In the content and headlines of the articles replace the old 2021 with the shortcode [[year]]. After inserting it I recommend scanning the site with the program Screaming Frog SEO Spider, adding the shortcode [[year]] in the Custom Search field. Perhaps your WordPress theme does not process it somewhere on the pages of categories or pagination.

Automatic Year Update in the Website Footer
Automatic update of the year in the website’s footer is a very simple task. All you have to do is open the footer.php file, find out where the year is, and replace it with PHP code:

However, I would like to draw your attention to another nuance. When you update the date every year and control the process through the Google search, you understand that the year in the footer hinders a lot!
For example, there is a site with thousands of pages. It’s New Year’s Eve, you’ve just scanned the site with Screaming Frog SEO Spider and at first sight everything is displayed correctly. What’s next? Reindex important pages throughout Google Search Console, and then check if everything is ok using the command:
site:domain.com 2021
And here the pages that have a year in their footers start hindering a lot. In fact, the year is correct, but it will take a lot of time for Google to re-index ALL the pages of your site. But if you don’t specify the year in the footer and insert it only where it is really needed for SEO, there won’t be the problem described above it will be easy to find irrelevant pages throughout search.
Year Format in Categories and Posts
This block logically follows the situation with the footer described above. If your site displays the post’s publication date (on the category page or on the post’s page), then I recommend you work with this as well. The idea is simple, to replace the publication date which looks like «20 March 2021», or «20.03.2021», with the format «20.03.21». Code:
<?php the_time('d.m.y') ?>
As a result the publication dates will not interfere with your page analysis.
Well, that’s all for today! Happy New Year!