Tài Hoàng

Automatically update the Current Year in your Footer’s Copyright Notice

Tired of manually changing the year in your website’s footer every January? Here’s a quick solution. With a small WordPress snippet, you can make the year update automatically — no more edits needed.

Add the following code to your functions.php file (or, even better, to a custom snippets plugin):

// CURRENT YEAR SHORTCODE
function copyright_shortcode() {
    $current_year = date('Y'); // Gets the current year
    return '<span class="copyright-text">© 2007 - ' . $current_year . ' Tài Hoàng. All rights reserved.</span>';
}
add_shortcode('copyright', 'copyright_shortcode');
Code language: PHP (php)

Remember to update the text in the snippet.

Once that’s in place, open your footer editor and insert this shortcode wherever you want your copyright notice to appear:

[copyright]Code language: JSON / JSON with Comments (json)

That’s it — your footer will now stay up to date automatically, year after year.

Reply via email