Update Your Copyright Notice Automatically

It is easy to forget to update the copyright notice on your website or blog every year. Fortunately, you don’t have to. Instead, you can use this bit of code:

<?php echo date('Y') ?>

Here is what this will look like on your website:

© 2013

(The code will output the current year, not 2013, if you happen to be looking at this in another year.)

Or, if you prefer, you can modify this to show a range from the beginning of your blog to the current year:

&copy; 2000–<?php echo date('Y'); ?>

Here is how that will look:

© 2000–2013

Add the copyright notice to your theme

If you are building a WordPress theme, you can add the above code directly to your footer.php file, or you can add it to your theme using functions.php. If you go with functions.php, here is the code to use:

function copyright_notice() { ?>
    '&copy;' <?php echo date('Y');
}

add_action('wp_footer', 'copyright_notice');

That’s it—never worry about updating your copyright notice again!

Last updated 2016-07-14.

Leave a Reply

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