Blog: WordPress
Calendar at end of year

Automatically Change The Copyright Year In WordPress

Avatar for John Locke

John Locke is a SEO consultant from Sacramento, CA. He helps manufacturing businesses rank higher through his web agency, Lockedown Design & SEO.

A common question for website owners is “How do I automatically change the copyright year in WordPress?”

Most WordPress themes have a place in the footer for copyright information or site credits.

Sometimes this is in the footer.php file, sometimes it’s not. It depends on the theme.

I’d like to show you not only how to change the copyright year automatically, but also how to change all types of dates in WordPress.

How WordPress Uses Dates and Times

WordPress core, themes, and plugins use PHP as a server-side programming language. What’s important to know is that WordPress uses PHP conventions for dates and times, and it uses the time from the server it is running on.

PHP has a function called date(). What the date function returns is the current date or time, as represented by certain letter symbols. Here is a chart of the more commonly used PHP date and time symbols.

CharacterDescriptionExample Output
YNumeric 4-digit yearEx: 2012, 2015
yNumeric 2-digit yearEx: 01, 16
FFull text of the current monthJanuary—December
mNumber of current month, with leading zeros01—12
nNumber of current month, no leading zeros1—12
MThree letters of current monthJan—Dec
lCurrent day, full name (lowercase “L”)Sunday—Saturday
DCurrent day, three lettersMon—Sun
dDay of the month, with leading zeroes01—31
jDay of the month, no leading zeroes1—31
SEnglish suffix for day of the weekst, nd, rd, th (1st, 2nd, 3rd, 4th, etc.)
zNumeric day of the year (starts with 0)0 through 365
HHour, 24 hour, with leading zeroes00 — 23
GHour, 24 hour, no leading zeroes0 — 23
hHour, 12 hour, with leading zeroes01 — 12
gHour, 12 hour, no leading zeroes1 — 12
iMinutes, with leading zeroes00 — 59
sSeconds, with leading zeroes00 — 59
aTime of day, lowercaseam, pm
ATime of day, uppercaseAM, PM
TTimezone abbreviationEST, PST, MDT, etc.
eTimezone identifierUTC, GMT, etc.

We’ll come back to this chart in future posts, but for now, let’s output the year to our WordPress footer

Automatically Change Copyright Year In WordPress Footer

To output your copyright year to the screen, we use a PHP language construct, called echo.

In simple terms, echo tells PHP to output whatever follows to the screen.

Here’s how we would output a copyright notice in WordPress that automatically updates the year whenever the calendar changes. Notice that we wrap PHP in it’s own opening and closing tags.

   * © is the HTML code for the copyright symbol. You can also use ©;
  **/  <p>Copyright © Your Website <?php echo date("Y"); ?>. All Rights Reserved.</p>

WordPress has several built-in functions of it’s own for dealing with times and dates, which we’ll talk about in coming articles.

Avatar for John Locke

John Locke is a SEO consultant from Sacramento, CA. He helps manufacturing businesses rank higher through his web agency, Lockedown Design & SEO.

2 comments on “Automatically Change The Copyright Year In WordPress

    1. Some WordPress themes are constructed to allow custom text in lower left or right hand side of the footer, or at the bottom of the footer. This would work for situations like that.

      Most people who are developing a theme will want the copyright year to update programmatically, so they don’t have to remember.

      They could use echo do_shortcode() with this plugin, as well.

Join the Conversation

Your email address will be kept private. Required fields marked *.