From 2c0b441337481a51da08bc38ef10e86a11eb756f Mon Sep 17 00:00:00 2001 From: maulikmakwana2008 <34104095+maulikmakwana2008@users.noreply.github.com> Date: Tue, 25 Nov 2025 00:28:30 +0530 Subject: [PATCH] Update shortcodes.php Add native shortcode to dynamically insert current year --- src/wp-includes/shortcodes.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/wp-includes/shortcodes.php b/src/wp-includes/shortcodes.php index 24c60b0021cb9..abca231bc868c 100644 --- a/src/wp-includes/shortcodes.php +++ b/src/wp-includes/shortcodes.php @@ -762,3 +762,13 @@ function strip_shortcode_tag( $m ) { return $m[1] . $m[6]; } + +/** + * Displays the current year. + * + * Example: [current_year] + */ +function wp_shortcode_current_year( $atts ) { + return date_i18n( 'Y' ); +} +add_shortcode( 'current_year', 'wp_shortcode_current_year' );