How to add a dynamic year in the copyright section

Kindly follow the below steps if you want to display the dynamic year in the copyright section.

Manually you can add a year function

  • Step 1 : Get into the file path /wp-content/themes/veda/functions.php paste the below code,

function copyright() { global $wpdb; $copyright_dates = $wpdb->get_results(" SELECT YEAR(min(post_date_gmt)) AS firstdate, YEAR(max(post_date_gmt)) AS lastdate FROM $wpdb->posts WHERE post_status = 'publish' "); $output = ''; if($copyright_dates) { $copyright = "© " . $copyright_dates[0]->firstdate; if($copyright_dates[0]->firstdate != $copyright_dates[0]->lastdate) { $copyright .= '-' . $copyright_dates[0]->lastdate; } $output = $copyright; } return $output; }


  • Get into the file path /wp-content/themes/veda/footer.php there you can add the below code,


echo copyright();

Third Party Plugin

You can use the below Automatic Copyright Year plugin to add a current year.

Rate This Article

(35 out of 73 people found this article helpful)

Leave A Comment?

This site uses Akismet to reduce spam. Learn how your comment data is processed.