Skip to content

Commit 2c0b441

Browse files
Update shortcodes.php
Add native shortcode to dynamically insert current year
1 parent f9e9f59 commit 2c0b441

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/wp-includes/shortcodes.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,3 +762,13 @@ function strip_shortcode_tag( $m ) {
762762

763763
return $m[1] . $m[6];
764764
}
765+
766+
/**
767+
* Displays the current year.
768+
*
769+
* Example: [current_year]
770+
*/
771+
function wp_shortcode_current_year( $atts ) {
772+
return date_i18n( 'Y' );
773+
}
774+
add_shortcode( 'current_year', 'wp_shortcode_current_year' );

0 commit comments

Comments
 (0)