Automatically Add the “Current Year” and Keep Your WordPress Content Fresh

Опубликовано: 15 Июнь 2026
на канале: WP Workshop
115
6

I have a bit of a love-hate 😅 relationship with mentioning the current year in my WordPress posts and pages.

On one hand, saying that your ranking of something is for 2024 🗓️ can make it more compelling. On the other hand, it's tough to keep those year mentions updated and accurate 🤔.

Do you just change the year every January 1st? Or is there a better approach? 🤷‍♂️

In this video, I'll share answers to these questions ✅.

You'll learn when to add the current year to your content, how to do it effectively, and how to stay honest 💡. Plus, I'll show you the simplest shortcode to automatically update the year in your posts and pages 🔧.

✘ https://x.com/iamkarolk

👇👇 THERE'S MORE! 👇👇

0:00 Intro
0:47 The main how-to
2:07 How to use the current year in post titles
2:29 The results
3:43 Why this method is good
5:19 Final thoughts

▬▬▬▬
❤️ Sub this channel:    / @wpworkshophq  
🌐 Find me at https://wpwork.shop/

▬▬▬▬
PARTNERS:

📰 Keep up with the latest WordPress news and in-depth stories at WPShout — your go-to resource for all things WordPress. https://bit.ly/4dVXGUp
🎯 Discover premium WordPress themes and insightful tutorials at Themeisle, designed to elevate your WordPress game. https://bit.ly/4dVWKzC
⚡️ Site slow? Optimize your images! Images often account for 80% of website weight. Optimole is a battle-tested solution to make them smaller and then deliver them through a global CDN. https://bit.ly/4dVWHUs

▬▬▬▬
🤣 WORDPRESS JOKE OF THE WEEK:

What did one WordPress plugin say to the other?

"Do we really need to hook up on every page?"

▬▬▬▬
CODE SNIPPET FROM THE VIDEO:

add_shortcode( 'this_year', function () {
//get last modified date of current post/page
$out = get_the_modified_date('Y');

//if featching date failed, default to current year
if(!$out) $out = date("Y");

//return year
return $out;
} );

//optional if you want to be able to use shortcodes in titles
add_filter( 'the_title', 'do_shortcode' );

▬▬▬▬
GEAR:

📸 Camera - Canon M6 Mark II: https://amzn.to/47l36Gc
👁️ Lens - Canon EF-M 32mm f/1.4 STM: https://amzn.to/4eapwfG
🎙️ Mic - Rode VideoMicro: https://amzn.to/3MGqkwN

▬▬▬▬
ℹ️ About: WP Workshop is your go-to hub for quick and easy WordPress tutorials.

#WordPress #blogging #contentcreation