A dynamic copyright year can be added to the WordPress footer by implementing a code snippet or shortcode, or without coding using the free Dynamic Copyright Year plugin.
Summary of methods to automate a WordPress footer copyright year:
- Add JavaScript or PHP code to the site’s code.
- Add a shortcode to the site’s footer.
- Avoid coding and install Dynamic Copyright Year plugin.
The changing of the New Year means website footers everywhere need updating. Have you ever visited a site with a copyright stuck in last decade? It makes you wonder if they are still in business. Or if you can trust they keep any information on their website current. Keeping the footer year up-to-date protects your copyright and it’s a good look.
I have a New Year’s resolution. Never edit my website footer on New Year’s Day again. Our new plugin dynamically updates the footer in WordPress, no coding or site edits required. Dynamic Copyright Year detects an existing old copyright year, and changes it to the current year based on the visitor’s location.
Here’s a snapshot of ways to automate your copyright year and how easy it is to use our plugin.
WordPress Copyright Footer Code
Method 1: Add JavaScript, HTML, PHP code to the site’s code.
Difficulty: Medium to High (particularly with hardcoded or complex themes)
This method requires code-level edits, or at least adding HTML code, to the footer of WordPress. This can be daunting for most users and take time to figure out. Editing the footer CSS code could break how the site functions and displays. Easy-peasy for a developer. Not so much for the rest of us.
There are code-snippets available from a quick search. Be sure the type of code used whether it is JavaScript or PHP is compatible with your site, theme, and placement (element or widget).
Here’s an example of how to add JavaScript WordPress copyright footer code:
Login to WordPress and copy this snippet into your header (via a header/footer plugin or a code snippets plugin):
<script>
document.getElementById(“year”).innerHTML = new Date().getFullYear();
</script>Then, in the footer of your site where you want the copyright year to appear, add this HTML:
© <span id=”year”></span>
Refresh your cache and browser, then do a lot of testing to make sure it worked and displays properly. Since it will be impossible to know if it changes to next year, the real test will be returning to your site January 1st to confirm the year turned over.
WordPress Copyright Year Shortcode
Method 2: Add shortcode to the site’s footer.
Difficulty: Easy to High (particularly with hardcoded footers)
Using shortcodes are an easy way to do all kinds of things on a website. A shortcode is a small piece of code in [brackets] that performs a feature or function on your website. You may have used it before on a form, gallery or button. It is somewhat of a placeholder or “insert here” call out that is identified by the Theme, a plugin or other coding which inserts the thing. In this case the thing is the current year.
To start using a copyright year shortcode you must first add code to your theme’s functions.php file or a code snippets plugin:
function copyrightyear_shortcode () {
$year = date_i18n (‘Y’);
return $year;
}
add_shortcode (‘copyright-year’, ‘copyrightyear_shortcode’);Then add the specific shortcode to your where ever you’d like it to display, usually done in a footer widget.
[copyright-year]
Refresh your cache and browser, then do a lot of testing to make sure it worked and displays properly. Since it will be impossible to know if it changes to next year, the real test will be returning to your site January 1st to confirm the year turned over.
NOTE: Prior to 2021 WordPress widgets did not support shortcodes. The current version of WordPress now allows shortcodes in widgets (and in the body content) by default. If you run an old version of WordPress, using shortcodes will require additional steps. It’s important to keep your site updated with the current version of WordPress for security fixes that protect your site from malware and attacks. Plus, you miss out on improvements like this one.
Method 3: Avoid coding and install the free Dynamic Copyright Year plugin.
Difficulty: Easy (no coding required)
Dynamic Copyright Year is a free plugin that automatically works, no coding or shortcode required.
This plugin detects the existing copyright year and dynamically updates it to the current year based on the visitor’s timezone. Visitors around the globe will see the year in their timezone at midnight.
It was designed to work on hardcoded Themes and hard-to-edit footers. The plugin detects copyright year text in your existing footer, then updates it to the current year. It even works on sockets and widgets. You won’t have to hire an expensive developer to figure out the site.
Here’s how to dynamically update a footer year without coding.
Step 1
Install Dynamic Copyright Year plugin and turn on automatic year updates.
If “© YYYY” or “Copyright YYYY” text exists in your footer, you are ready to go.Step 2
Test it right now.
Refresh your site to view the footer change from a past to the current year.Step 3
Create footer policy links.
Use Premium options to add text links next to the copyright, and receive premium email support if you run into any issues.
Install the free copyright year plugin from WordPress.org to display the new year across the globe.
Developed by 5 Star Plugins in the US
Our plugins go through rigorous testing prior to release and must be approved to meet the standards of WordPress.org plugin reviewers. Plugin updates are free to keep your site secure with the current version of WordPress. Free support is provided through the plugin’s WordPress.org support forum.