Automatically Update Copyright Year

Automatically Update Copyright Year

Automatically update copyright year in WordPress to save time and keep your website looking professional. Many site owners forget to update the copyright year manually, which makes their site look outdated. With just a few lines of code or a simple shortcode, you can make your copyright notice always show the current year automatically.

Why You Should Automatically Update Copyright Year

  • Professional Look: An outdated year (e.g., 2021) makes your site look neglected.
  • Time-Saving: No need to edit the footer every January.
  • Dynamic & Accurate: The copyright year always reflects the present date.

Method 1: Simple JavaScript

Add this code snippet in your footer area or HTML block where you want the year to appear:
Copyright © <script>document.write(new Date().getFullYear())</script>. All Rights Reserved
If you want to display a date range, use this version:
Copyright © 2020-<script>document.write(new Date().getFullYear())</script>. All Rights Reserved

Method 2: WordPress Shortcode (functions.php)

If you prefer a WordPress-specific solution, you can create a shortcode. Add the following function inside your functions.php file:
function year_shortcode() {     $year = date('Y');     return $year; } add_shortcode('year', 'year_shortcode');
Now, whenever you want to display the current year, simply use:
[year]
This works perfectly in posts, pages, and even your footer widget.

Which Method Should You Use?

  • Use JavaScript if you just need a quick fix without editing theme files.
  • Use the WordPress Shortcode if you want a clean and reusable method across your site.
Both methods ensure your copyright year automatically updates every January, keeping your website accurate and professional.

Final Thoughts

Manually updating your copyright year is easy to forget, but it creates a poor impression. By using the methods above, you can make your WordPress site automatically update the copyright year and always look current.

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.