Are you looking for a simple but effective way to add a dynamic copyright date to your WordPress footer? That means you are able to make your site create a copyright date via the published date of the newest and oldest post automatically. If you want to do that, let us help you with the instruction in the blog today. Now, let’s check it out!

PHP method

In order to use this way, your site needs to be at least one year old. Now, all you need to do is open the footer.php file, then add the following code at the line you want to showcase the copyright:

<p>&copy; 2020 – <?php echo date('Y'); ?></p>

However, there is a downside to using this solution: it cannot automatically fetch the start date of your site.

Elegant WordPress solution

If you don’t want to use the way above or your website has only been published recently, let’s try the solution below. When you utilize the method, you will add the following code in the theme’s functions.php file or a site-specific plugin:

function comicpress_copyright() {
global $wpdb;
$copyright_dates = $wpdb->get_results("
YEAR(min(post_date_gmt)) AS firstdate,
YEAR(max(post_date_gmt)) AS lastdate
post_status = 'publish'
$output = '';
if($copyright_dates) {
$copyright = "&copy; " . $copyright_dates[0]->firstdate;
if($copyright_dates[0]->firstdate != $copyright_dates[0]->lastdate) {
$copyright .= '-' . $copyright_dates[0]->lastdate;
$output = $copyright;
return $output;

This code will support you to create dynamic copyright via the published date of not only the oldest but also the newest post. In case it is the first year of the site, this feature will help you showcase the current year.

After adding the code above, let’s go to the theme’s footer.php file. Then, simply add the following code to the place you want to present the date:

<?php echo comicpress_copyright(); ?>

Now, you can see the text below:

© 2009 – 2021


All in all, with the two methods we have already introduced to you, we hope that you can easily keep your copyright dates updated. If you think this blog is useful, don’t hesitate to share it with your friends. Furthermore, don’t forget to visit our site when you have free time because we will provide you with many Free WordPress Themes.

5/5 - (2 votes)

Summer Sale Grab 50% Off for everything on today, don't miss it. Coupon code: SUMMER2024 Redeem Now
Summer Sale Grab 50% Off for everything on today, don't miss it. Coupon code: SUMMER2024 Redeem Now