Are you still manually changing the year in your WordPress footer? If so, did you know there’s a quicker and easier way to dynamically show the date in your footer? The method described below will automatically show the current year in your copyright footer.
For this, we need to edit your theme files. Before we do this, ensure you have a backup of your theme files. In case something goes wrong, you can use the backup files to resolve the issue.
In order to add this code, we need to locate the
footer.php file within your theme files. I recommend logging into your site using FTP. Find your
wp-content folder. Then your active theme directory, and within it you should find the
footer.php file. Open the file in a text editor.
If you don’t want to use FTP, you can also locate the
footer.php file within the WordPress Dashboard (by going to Appearance > Theme Editor) if your theme allows.
Paste one of the following options where you want to display the copyright notice before the closing
</footer> tag in your
A) Simple way to show the current year
<p>© Copyright <?php echo date('Y'); ?></p>
© Copyright 2021
B) Simple way to show a date range
<p class="site-copyright">© Copyright 2010 - <?php echo date('Y'); ?></p>
© Copyright 2010 - 2021
C) Showing the current year with your blog name
<p class="site-copyright"><?php printf(__( 'Copyright © %1$s %2$s', 'themeslug' ),date( 'Y' ),get_bloginfo( 'name' )); ?></p>
© Copyright 2021 Blog Title
And there you have it – your footer will now show the current year without you having to make any changes. Play around with the text to display want you want.
Want to learn more about WordPress?