I was updating my WordPress sites and noticed the copyright year on all my footers were still 2023... I thought they were supposed to automatically update lol.
I didn't want to install another plug-in so I searched around for the easiest manual solution... and found it here!
Here's all I had to do:
1. Copy the following code to the very bottom of my functions.php file... I made certain not to change anything or add spaces anywhere:
function year_shortcode() {
$year = date('Y');
return $year;
}
add_shortcode('copyrightyear', 'year_shortcode');
2. Add the shortcode: [copyrightyear] (yes, including the brackets) to my footer where I want it to appear.
3. Save!
I updated all my websites so the copyright in my footer should update each year!