How to Auto Update the Copyright Year in a WordPress Footer

An out-of-date copyright year in a site’s footer is a common sight, especially early in a new year. It happens because people don’t take advantage of WordPress’s server-side language, PHP, to auto-update the copyright year in WordPress. Instead they’re manually changing it. But it’s a complex and menial task, so it’s easy to put off.
Copyright statements are tiny and easy to overlook, but having a current one is a mark of a well-maintained site. If it’s been on your to-do list to change over your site’s year manually (like it’s been on mine!), this tutorial will teach you how changing a few lines of code will mean that you’ll never have to worry about it again!
Figuring out how to auto update the copyright year in HTML is easy if you use the power of programming language like PHP. Here’s how to prevent this problem and automatically update copyright year on your WordPress site. First, on video:
And if you prefer, in writing…
Auto Update Footer Copyright Year with PHP
- Open up your text editor and FTP software. In this example, I’ll be using a program called Coda which functions as both. You should already have your FTP software configured so you have access to the server-side files for the site you’re working on. This is the first step to update the copyright year in WordPress.
- Open up
footer.php
in your Parent theme’s folder on your server. In this case, the location of the file is:public_html/wp_content/themes/rosemary/footer.php
. - Copy all the code in your Parent theme’s
footer.php
file. - Create a new file within your child theme and title it
footer.php
. - Paste the code you copied from your parent theme’s footer into the new
footer.php
file you created within your child theme. - Now’s the time to auto-update copyright year! Find the portion of the code in your footer that controls the date. Typically it will be something as simple as finding the previous year’s text (ie.
2015
) and replacing it withecho date( 'Y' )
. It sometimes recommended that you state this as a range, like 1999-{current year}. You can generally add any other text necessary for your copyright here. Because our theme was set up to be able to edit the date from the appearance customizer, it looks slightly different. - That’s it! Save the changes to your server and check your site to make sure all the changes you made worked as expected. Keep in mind that you might need to delete your cache if your changes aren’t appearing immediately.
Now You Can Auto Update Your Copyright Year
Never look like a doof with an out-of-date footer year again. Thanks to the functionality of the auto-update copyright year in PHP, your website will be looking good (or at least better) from top to bottom.
Add a Comment