Here is the code to copy into your functions.php file or into the My Custom Functions plugin.
Once the code below is in place, put the shortcode 2023 wherever you want the current year to appear on your site.
function current_year_shortcode() {
$year = date('Y');
return $year;
}
add_shortcode('year', 'current_year_shortcode');
Advertisement
Responses