Having an up-to-date copyright year in your website’s footer is crucial—it shows that your site is maintained and current and that you pay attention to important details. An outdated copyright year, on the other hand, can cause your site visitors to wonder if you actively manage your site. If you have a WordPress website, you can use a simple code snippet in your theme’s functions.php file to ensure your copyright date updates automatically every year. So no more having to remember to update the copyright date on New Year’s!
Why Is It Important to Keep Your Copyright Year Current?
Let’s review some of the key reasons why this is important:
- Trust and Credibility: A current year shows visitors that your site is actively managed and updated.
- Legal Protection: Keeping the copyright year current indicates the ongoing ownership of your intellectual property.
- Professionalism: An outdated copyright date may create a perception of neglect, discouraging potential visitors or customers.
Steps to Add a Shortcode for the Current Year
Before You Begin: Always back up your WordPress site before making changes to core files like functions.php.
Step 1: Open Your Theme’s functions.php File
- From your WordPress admin dashboard, go to Appearance > Theme File Editor.
- Select
functions.phpin the list of files on the right.
Step 2: Add the Shortcode Code Snippet
Insert the following PHP code snippet into the functions.php file. This code creates a shortcode that outputs the current year.
// Add a shortcode for displaying the current year
function display_current_year() {
return date('Y'); // Returns the current year
}
add_shortcode('current_year', 'display_current_year');
Explanation of the Code:
- The
display_current_year()function utilizes PHP’s built-indate()function to get the current year ('Y'format). - The
add_shortcode()function registers the shortcode[current_year], which you can use anywhere on your WordPress site.
Step 3: Save Your Changes
Click the “Update File” button to save your changes to functions.php.
Step 4: Use the Shortcode in Your Footer
- Go to Appearance > Widgets or your Footer template in the block editor (depending on your theme).
- Add the
[current_year]shortcode within the text area where you want the copyright year to appear. Here’s some sample HTML:
© [current_year] YourCompanyName. All Rights Reserved.
Once the page loads, WordPress will replace [current_year] with the current year.
Step 5: Test the Shortcode
Visit your website and confirm that the current year is displayed correctly in the footer. Reload the page and clear your browser cache if needed.
Wrapping up
Now you’ll be able to enjoy New Year’s and not have to worry about updating your website’s copyright date. You’ll no longer need to update it manually each year. We come across this issue all of the time – even on web designer’s websites. So take a few minutes to do this as it makes your site look more professional and credible. And it also shows visitors (and search engines!) that your website is alive and thriving.
Happy coding! If you have questions or want to explore further customization for your WordPress site, feel free to contact us.





