How to Auto Update the Copyright Year in a WordPress Footer

Published: August 15, 2018,  
Posted in: ,  
Tags: , ,

Having an out of date copyright year on a WordPress sight is far too common. 

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 quick to do menial task, so it’s easy to put off setting it to update automatically.

Copyright statements are such a small part of a website and easy to overlook, but having a current one is a mark of a well-maintained site and does create an impression with visitors.

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. 

Auto Update Footer Copyright Year with PHP

  1. Step 1 only applies if you don't already have a child theme in palce that has a footer.php file. Open up your text editor and FTP software. In this example, I’ll be using a program called Sublime Text and Filezilla. 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.
  2. 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/divi/footer.php.
  3. Copy all the code in your Parent theme’s footer.php file.
  4. Create a new file within your child theme and title it footer.php.
  5. Paste the code you copied from your parent theme’s footer into the new footer.phpfile you created within your child theme.
  6. 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 with echo 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 the Divi theme has the ability to edit the date from the appearance customiser, it looks slightly different.
  7. 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.

Leave a Reply

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

Get Notified Of New Posts
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram