How to display the current year for the copyright label in WordPress footer

September 29th, 2020

If you want to display the current year, such as to the copyright section in the footer of your WordPress website, just add in this simple snippet. It will automatically update which will help keep your site up-to-date.

date('Y');

Keep in mind, this particular snippet will only work when added to the PHP template files and not in the general admin or edit-post areas. The full line might look something like this:

<p>&copy; <?php echo date('Y'); ?> <?php bloginfo('name'); ?></p>

You can format the date or include the month and date by using different characters within the single-quotes. Here are some examples from Documentation at php.net

Some examples of date() formatting. Note that you should escape any other characters, as any which currently have a special meaning will produce undesirable results, and other characters may be assigned meaning in future PHP versions. When escaping, be sure to use single quotes to prevent characters like \n from becoming newlines.

<?php
// Assuming today is March 10th, 2001, 5:16:18 pm, and that we are in the
// Mountain Standard Time (MST) Time Zone

date("F j, Y, g:i a");                 // March 10, 2001, 5:16 pm
date("m.d.y");                         // 03.10.01
date("j, n, Y");                       // 10, 3, 2001
date("Ymd");                           // 20010310
date('h-i-s, j-m-y, it is w Day');     // 05-16-18, 10-03-01, 1631 1618 6 Satpm01
date('\i\t \i\s \t\h\e jS \d\a\y.');   // it is the 10th day.
date("D M j G:i:s T Y");               // Sat Mar 10 17:16:18 MST 2001
date('H:m:s \m \i\s\ \m\o\n\t\h');     // 17:03:18 m is month
date("H:i:s");                         // 17:16:18
date("Y-m-d H:i:s");                   // 2001-03-10 17:16:18 (the MySQL DATETIME format)
?>

Want to work with us?

No project too big or small. Send us a message and let us know a little about what you're looking for.

[recaptcha]