Automatically update copyright year

It is that time of the year where you do a lot of update activities on your blog including stock taking of the past year, wishing friends & family, setting goals, taking new year resolutions etc. It is also a good time to update certain important areas of your blog – Yes I am talking about updating the copyright year on the footer of your blog.

When I checked most of my friends’ blogs today I found that the copyright year is still 2009. Mostly, every year you hardcode this value but there is an easy way to auto update the copyright year using a simple one-liner script. Once it’s in place, you don’t have to worry about updating the year again. The following is the copyright script that you need to add to the footer of your WordPress blog (or any blogging platform running PHP):

Auto update copyright year script

The following is the simplest form of the script that you can include in an appropriate part of your footer:

Copyright &copy; <?php echo date(‘Y’); ?>

(Just replace with your blog name or domain name. You can also get it from the settings by using bloginfo(‘name’) within the PHP brackets)

This will render your copyright information as:

Copyright © 2010

You can play around with other options such as:

&copy; <?php echo date('Y'); ?> get a result like this

© 2010

or even give an year range using…

Copyright &copy; 2005-<?php echo date('Y'); ?>

..where the output will be as given below:

Copyright © 2005-2010

(Year range copyright assuming that 2005 was your starting year from when the copyright is applicable)

Note: This script takes the date and year information of the server. Hence, if your hosting server is in the US, and if you are browsing from India or so on New Year morning, do not panic if you see still 2009. By midnight or on the following morning you will see the copyright year reflected. You can also use a Javascript code to update the year which will overcome this minor issue but I prefer to stick with PHP.

Have you already updated the copyright year on your blog?


  1. That is really handy, because I always forget to update the year on my blogs.

  2. After reading first few line I rush for the update and after reading the whole tutorial I put the code. Thanks for sharing this.

  3. Good point. I’ve been doing exactly the same on my blog from the day 1. The original free theme I had on my blog earlier had this code to get it done. I took that and started using it on the thesis theme also.

  4. Just made me remember I have to update mine too. :)

  5. Melvin :

    luckily my theme already does that for me.. 😀

  6. Melvin :

    and by the way (offtopic), you already received my head to head questions?

  7. Will try this.

  8. Nihar :


    I did this change 2 days ago and also thought of posting a blog post.

    Here it is…. May be i should do it so that my blog readers can also get to know.

  9. Hi Ajith, I just want to share something here mate :)
    About your article on auto-update copyrighter years, I do not even updated it … but I deleted it from my footer LOL but thanks for sharing your tips, maybe I’ll use your tips next time on my other blog.

  10. Nigel :

    Nice tip Ajith, thanks very much, just implemented. :)

  11. Cool php code. loves it. I guess that means my hardcoding days are over.

  12. Good tip from a great programmer (I read your interview in melvinblog recently and I see you describing yourself as 90% programmer…automating blog is again very interesting..)

  13. Anonymous Coder :

    JavaScript version:

    document.write(new Date().getFullYear())

    The will print the current year, so just insert this after the © symbol in your footer.

  14. This is the code I used for a long time until I realized that the year is pulled based off of GMT, so if you don’t want users in different time zones to see your site’s year change early or late, don’t use this tag…change echo date to echo date_i18n

    For example, when I used the original code, I went to my website on Dec 31st, 2014 at around 6pm PST. My website was already showing the year 2015 because Pacific Standard Time is 8 hours behind GMT.

    With the date_i18n change, your site will show the current year based on the visitor’s timezone instead. For those that are curious, i18n is an abbreviation of “internationalization” because there are 18 letters between the ‘I’ and the ‘N’.


  1. […] it and are looking for tips on how to do then you can read this post on dot com mogul John Chow or this post by […]

Speak Your Mind