Table of Contents Hide
If you have a WordPress website, you may have noticed that the copyright year in the footer doesn’t update automatically. This can be a hassle to manually update every year, especially if you have multiple websites to manage.
Fortunately, there is a simple solution to this problem: you can use a snippet of PHP code to automatically update the year in the WordPress footer. In this post, we’ll show you how to do it.
Before we get started, there are a few things you’ll need:
- A WordPress website with access to the source code
- Basic knowledge of HTML and PHP
var currentYear = new Date().getFullYear(); document.getElementById("year").innerHTML = currentYear;
Step 2: Add the year to your footer
Depending on your theme, you may have different ways of updating your footer. But here’s some steps you can follow that should work on most WordPress themes:
- Log in to your WordPress dashboard and go to
Appearance > Customize.
- From the Customizer menu, click on the
- Here, you should have the option to update your copyright text. Simply add the HTML code as shown below.
- Click the
Publishbutton to save your changes.
© <span id="year"></span> YourWebsiteName. All Rights Reserved.
Step 3: Test the Footer
We hope this post has been helpful. If you have any questions or need further assistance, feel free to leave a comment below. You can also learn more about WordPress by checking out our articles here.