Add in your functions.php
function current_year( $atts, $content = null ) {
$current_year = date("Y");
return $current_year;
// [currentyear]
}
add_shortcode( 'currentyear', 'current_year' );
If you want to use plain PHP, you can use:
$current_year = date("Y");
echo $current_year;
Have any questions or comments? Write them below!