The WPFolks app is out on iPhone and Android. Free, no ads. Download on the App Store Get it on Google Play
Skip to main content
Login Join
Snippet · PHP

Display Current Year Using WordPress Shortcode

Shared by Shatrughan Myatra · May 25, 2026

2 copies
33 views
Back to Snippets

Simple WordPress shortcode to automatically display the current year anywhere on your website. This shortcode is useful for dynamic copyright text, footers, and content sections without manually updating the year every time.

function current_year_shortcode() {
    return date('Y');
}
add_shortcode('current_year', 'current_year_shortcode');
Know a different way to do this? Add your approach as a variation so folks can compare them side by side.
Submit a variation

0 comments