{"id":252395,"date":"2023-01-03T00:36:22","date_gmt":"2023-01-02T20:36:22","guid":{"rendered":"https:\/\/cs-webdesigns.com\/?p=252395"},"modified":"2025-05-04T15:11:00","modified_gmt":"2025-05-04T11:11:00","slug":"update-year-automatically","status":"publish","type":"post","link":"https:\/\/cs-webdesigns.com\/en\/webinsights\/tutorials\/wordpress\/jahreszahl-automatisch-aktualisieren\/","title":{"rendered":"How the year is automatically updated on your website (e.g. in the footer \u00a9)"},"content":{"rendered":"<p>Tired of manually changing the dates on your website every year? Then I've got just the thing for you.<\/p>\n<p>With a simple 4 lines of PHP code, WordPress automatically sets the current year. Provided that your server's time is set correctly. However, I would assume that this is the case.<\/p>\n<h2>2 easy steps for automatically updated year<\/h2>\n<h3>1a. Add this code to your functions.php (my recommendation)<\/h3>\n<p>The best way to do this is to use a <a href=\"https:\/\/cs-webdesigns.com\/en\/what-is-a-child-theme-and-when-should-you-use-it\/\" target=\"_blank\" rel=\"noopener\">Child theme<\/a>which I have described in more detail in this blog post.<\/p>\n<div>\/\/ COPYRIGHT YEAR AS SHORTCODE \/\/<\/div>\n<div>function year_shortcode() {<\/div>\n<div>$year = date(\u201aY\u2018);<\/div>\n<div>return $year;<\/div>\n<div>}<\/div>\n<div><\/div>\n<div>add_shortcode(\u201ayear\u2018, \u201ayear_shortcode\u2018);<\/div>\n<div><\/div>\n<h3>1b. Insert this code with the plugin code snippet<\/h3>\n<div>\n<p>If you are not so familiar with the WordPres folder structure and PHP, you can also implement this code risk-free via code snippets. However, I strongly recommend that you implement it using method 1a in the child theme. Nevertheless, I would like to show you a possible alternative.<\/p>\n<p>To do this, install the Code Snippets plugin and create a new snippet with the above code.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-252411\" src=\"https:\/\/cs-webdesigns.com\/wp-content\/uploads\/2023\/01\/Jahreszahl-in-Code-Snippets-umsetzen.png\" alt=\"Convert year into code snippets\" width=\"408\" height=\"298\" \/><\/p>\n<p>The practical thing about the plugin is that you cannot \u201edestroy\u201c your site with it. The plugin checks whether it causes an error when the code is activated. If so, the code will not be activated.<\/p>\n<h3>2. enter 2026 as the year<\/h3>\n<p>Then you just have to insert the shortcode \"year\" in the square brackets, which reads out the year of the server time or date, into the text instead of the manual year.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-252413\" src=\"https:\/\/cs-webdesigns.com\/wp-content\/uploads\/2023\/01\/Jahreszahl-im-Copyright-richtig-eingeben.png\" alt=\"Enter the correct year in the copyright\" width=\"444\" height=\"482\" \/><\/p>\n<h3>Conclusion: The year will now update automatically<\/h3>\n<p>This is how you can save yourself an annoying, annual ritual with four lines of code \u2013 especially if you maintain multiple websites. I recommend you implement it with variant 1a. If you don't use a child theme yet, check out my blog post about it. That's also very easy and quick to do.<\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Put an end to the annual routine of updating the year (e.g. in the copyright, but also possible everywhere else) in the new year. I'll show you a very simple trick to keep the year up-to-date automatically. <\/p>","protected":false},"author":1,"featured_media":254671,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_seopress_robots_primary_cat":"","_seopress_titles_title":"Jahreszahl in WordPress automatisch aktualisieren","_seopress_titles_desc":"Mit diesem einfachen Trick aktualisiert sich die Jahreszahl auf deiner Webseite, z. B. im beim Copyright im Footer, v\u00f6llig automatisch. ","_seopress_robots_index":"","_et_pb_use_builder":"off","_et_pb_old_content":"","_et_gb_content_width":"","iawp_total_views":896,"footnotes":""},"categories":[39],"tags":[],"class_list":["post-252395","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress"],"_links":{"self":[{"href":"https:\/\/cs-webdesigns.com\/en\/wp-json\/wp\/v2\/posts\/252395","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cs-webdesigns.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cs-webdesigns.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cs-webdesigns.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cs-webdesigns.com\/en\/wp-json\/wp\/v2\/comments?post=252395"}],"version-history":[{"count":0,"href":"https:\/\/cs-webdesigns.com\/en\/wp-json\/wp\/v2\/posts\/252395\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cs-webdesigns.com\/en\/wp-json\/wp\/v2\/media\/254671"}],"wp:attachment":[{"href":"https:\/\/cs-webdesigns.com\/en\/wp-json\/wp\/v2\/media?parent=252395"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cs-webdesigns.com\/en\/wp-json\/wp\/v2\/categories?post=252395"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cs-webdesigns.com\/en\/wp-json\/wp\/v2\/tags?post=252395"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}