image 7
image 8
image 9
image 10
image 11
image 12


Automate your SEO

Add today's date by [date], current year by [year], previous year by [pyear], next year by [nyear], current month (like January) by [month] and current month shortname (like Jan) by [mon] shortcodes anywhere, including content and title. Use this plugin to boost your site's SEO by using the variables anywhere.

  • Supports RankMath, Yoast and SEOPress plugins and can be used to replace all their date based variables.
  • [year] works as a replacement to %currentyear% , [month] as a replacement to %currentmonth% already.
  • Use various combinations to make your articles even more dynamic and make your content always SEO ready — no matter the date or year.


Tested to be working with Yoast SEO, SEOPress and Rank Math's breadcrumbs, custom meta titles, excerpt etc.

Rankmath SEO plugin is (very) recommended but not required.

More features

  • Full Rank Math OpenGraph Support.
  • Schema and OpenGraph support in YoastSEO.
  • Multiple Langauge (WPML) Support: Shortcode renders your site's defined language.
  • Contextual Related Posts Support
  • Totally native. No configuration required.

Easy to use

Just install the plugin (see Installation) and activate it. Add [year] to render current year, [nyear] to render next year, [pyear] to render previous year, [month] to render current month (full name) and [mon] to render first three letters of months automatically. As the months & years change, these shortcodes get updated into the content and title automatically on the shortcode locations.

Zero bloat. No CSS/JS files loaded.

More details | 24X7 Support | More WordPress Plugins | Request a Feature


Dynamic Month & Year into Posts is a completely native shortcode plugin. It has no settings page and does not use any analytics tool to gather or use your data. It's bloat and ad-free.

Fast Support and Feature Implementation

I will provide instant support for all your queries or feature requests. Use support forum to ask your questions, request new features or report something broken.

I will try my best to ensure that this plugin is compatible with every functionality plugin you use.

How to use it?

Just install the plugin (see Installation tab) and activate it. Add [year] to render current year, [nyear] to render next year, [pyear] to render previous year and [month] to render current month automatically. As the months & years change, they get updated into the content and title automatically on the shortcode locations. There are other shortcodes as well.


  1. Upload the plugin folder to the /wp-content/plugins/ directory, or install the plugin through the WordPress plugins screen directly.
  2. Activate the plugin through the ‘Plugins’ screen in WordPress
  3. There is no additional configuration required. There will not be any menus or settings for this plugin.


Click to copy a shortcode to clipboard.

  • Add today's date by [date]. Output: July 15, 2024
  • Current year by [year]. Output: 2024
  • Previous year by [pyear]. Output: 2023
  • 2 years back from this year [ppyear] (read previous-previous year). Output: 2022
  • Next year by [nyear]. Output: 2025
  • 2 years from this year [nnyear] (read next-next year). Output: 2026
  • Current month (July) by [month]
  • Next month (like August) by [nmonth]
  • Previous month (like June) by [pmonth]
  • Current month shortname (like Jul) by [mon]
  • Next month shortname (like Aug) by [nmon]
  • Previous month shortname (like Jun) by [pmon]
  • Current month in number with trailing zero (like 07) by [mm]
  • Current month in number without trailing zero (like 7) by [mn]
  • [dt] shortcode renders only the day of the month (like 1, 2, 3, 17, 28); Mix this with other variables to create a custom date format.
  • Show current month and year together (like July 2024) by [monthyear].
  • Show previous month and year together (like June 2024) by [pmonthyear].
  • Show next month and year together (like August 2024) by [nmonthyear].
  • Capitalize a month name by prefixing c to the shortcodes, like [cmonth], [cnmonth], [cmon] and so on.
  • [weekday] for today's day of the week like Monday and [wd] for the short form of the day like Mon.
  • [blackfriday] to show Black Friday date like November 29.
  • [cybermonday] to show Cyber Monday date like December 2
  • [datemodified] to show the date current post was modified like July 14, 2024.
  • [datepublished] to show the date current post was published like February 15, 2020.


screenshot 1
screenshot 2


1.3.7New: [nmonthyear] and [pmonthyear] display next and previous month and years together. Useful in many cases.
1.3.6Shortcode support in Archive Titles.
1.3.5Made Black Friday and Cyber Monday dates totally dynamic and auto-updating.
Use [year n=number] to display any year next or previous to this year. For example [year n=5] renders 5th year from now and [year n=-5] renders 5th year back from today.
1.3.4Two new useful shortcodes. Post modified/updated date: [datemodified] and post publication date: [datepublished]. Use these anywhere you want to make your site more dynamic and SEO friendly.
1.3.3Revert some changes
1.3.2Full Yoast SEO Support. Finally.
Optimized Code
SEOPress Support complete
1.3.1Date change for Black Friday and Cyber Monday dates
1.3.0New: [blackfriday] and [cybermonday] shortcodes render this year's Black Friday and Cyber Monday dates like November 25 and November 28. Couple these with [year] to make the dates complete. See this example
Added Intelly Related Posts a.k.a. IRP support.
1.2.9Readme update.
1.2.8Fixed some issues related to rendering of next month.
[monthyear] no longer prints next month after 28th. Reason: User experience, as the user may be tricked to thinking the wrong current month and year names.
1.2.7Fix: [monthyear] shortcode rendered English months in other languages.
1.2.6New: Full Elementor Support. Now the shortcodes should render in all core and Elementor Pro widgets
1.2.5New shortcodes: [weekday] for today's day of the week and [wd] for the short form of the day.
1.2.4Added: JSON-LD support for Yoast SEO Schema. Props to @sathoro
Upcoming: Intelly Inline Related Posts Plugin support
1.2.3Improved: [monthyear] shortcode renders next month if the current month is about to end, after 28th every month.
1.2.2New: Capitalize Month Names. Add c before any month based shortcode to render it capitalized. Useful in various languages where Month names are generally in small letters, like French, Swedish etc.
Example shortcodes: [cmonth], [cmon], [cnmonth], [cpmonth], [cnmon], [cpmon] etc.
New Shortcodes: [nnyear] and [ppyear] show 2 years next and previous years, like 2026 and 2022 respectively.
New Shortcode: [monthyear] shows current month and year together for specific purposes.
Better compatibility with Rank Math Pro and Elementor.
1.2.1New Shortcodes: [mm] renders month number including trailing zero (01-12)
New Shortcodes: [mn] renders month number without trailing zero (1-12)
Full Jetpack Related Posts Support (Thanks Jetpack team!)
1.2.0WordPress 5.8 Support
New Shortcode: [nmonth] renders next month (full name)
New Shortcode: [pmonth] renders previous month (full name)
New Shortcode: [nmon] renders next month (short name, like Jan, Feb)
New Shortcode: [pmon] renders previous month (short name, like Dec, Nov)
1.1.9IMPROVED! Performance by removing rank_math/paper/auto_generated_description/apply_shortcode; the filter that causes more load on sites, especially where wp_query is used.
This is the first of many attempts to remove unnecessary elements.
1.1.8Revert some of the changes in 1.1.6
1.1.7Bug fixes.
1.1.6NEW! [dt] shortcode to render only the day of the month (like 1, 2, 3, 17, 28). Combine this with other shortcodes to create date formats you desire.
Added support for shortcodes in Rank Math’s Product schema description
IMPROVED! [date] shortcode renders date as set by Dashboard -> Settings -> General -> Date.
1.1.5New: [mon] shortcode to render only the first three letters of the Month, like Jan, Feb, Mar, Apr etc.
1.1.4Tested with WordPress 5.8
1.1.3Bug Fixes {not really: I made a coding mistake}
1.1.2Updated Readme.txt and Instructions
1.1.1Bug fixes
1.1.0New: Rank Math OpenGraph SupportBug fixes
1.0.9Improved: Schema and OpenGraph support in YoastSEO.
Work in Progress: Full Schema and OpenGraph support in Rank Math
Removed: Rank Math recommendation.
1.0.8New: Contextual Related Posts Support
1.0.7New: SEOPress Support
1.0.6New: Yoast SEO Support
1.0.5Multiple Language Support: Shortcode renders your site’s defined language.
New: [date] shortcode for today’s date.
WordPress 5.6 Compatibility
1.0.3Updated Readme.txt file
1.0.2[pyear] yields previous year (e.g., 2023
[nyear] yields next year (e.g., 2025)
1.0.1Fixed Name Conflicts
1.0.0First version


Why would I need this?

If you are an affiliate marketer or blogger who uses months, years and dates in your posts. If you use this plugin to render dynamic month, year, date, next year, and previous year shortcodes, you won't have to update those posts again and again as time passes.

How can I access settings?

You cannot. There is no options panel because there is no need to have one. Why bloat the WordPress dashboard with more options?

Can I use it in Block Editor or Classic Editor?

Like running text, you can use the shortcodes in both Block Editor and Classic Editor. You can also use the shortcodes in widget areas, including the footer (use-case: Autoupdating Copyright Year) and headers (use-case: Today’s Date).

Will this plugin work in my language?

Yes. The shortcode outputs are WPML ready and render as per the language set in your WordPress dashboard. Since there is no settings page, you don’t have to translate this plugin.

How can I use these shortcodes in my theme/PHP code?

Yes. You can use <?php echo do_shortcode('[year]');?>, <?php echo do_shortcode('[month]');?> etc., in themes or in functionality plugins to use these shortcodes.

How can I render shortcodes in ACF fields?

This plugin doesn’t render shortcodes in ACF fields by default (due to various reasons, security being the first). But if you really need to render [year] etc., shortcodes, you can enable selective rendering.
Just add this code in your theme’s functions.php file or in the Code Snippets plugin:
ACF field type => text
add_filter('acf/format_value/type=text', 'do_shortcode');
ACF field name => headline
add_filter('acf/format_value/name=headline', 'do_shortcode');

Important Hooks and Filters

Enable shortcode rendering in Advanced Custom Fields areas

add_filter('acf/format_value/type=text', 'do_shortcode');

Disable rendering of shortcodes in Preformatted and Code blocks


function dmyip_replace_shortcode($string) {
    $replace = array( '[' => '[', ']' => ']' );
    $newstring = str_replace( array_keys( $replace ), array_values( $replace ), $string[2] );
    return $string[1] . $newstring . $string[3];
function dmyip_prevent_shortcode( $content ) {
	$pattern = '#(<pre.*?>|<code.*?>)(.*?)(<\/pre>|<\/code>)#imsu';
	return preg_replace_callback( $pattern, 'dmyip_replace_shortcode', $content );
add_filter( 'the_content', 'dmyip_prevent_shortcode', 9);