Posted by & filed under WordPress.

Usage

Use [year] in your posts.

Snippet

Place the code above in functions.php file

function year_shortcode() {
  $year = date('Y');
  return $year;
}
add_shortcode('year', 'year_shortcode');

Leave a Reply

Your email address will not be published. Required fields are marked *