Skip to content
Gaurav TiwariDocs

How to Keep the Year in Post Titles Current Without Editing Posts

Updated October 19, 2026

A title like “Best Laptops for Students in 2025” starts to look old on January 1. If you run a few dozen of these posts, every New Year means opening each one, changing one number and hoping you didn’t miss any.

A dynamic year in the post title fixes that for good. You type [year] into the title once, and WordPress prints the current year on the page, in the browser tab, in the RSS feed and in the admin post list.

Dynamic Month & Year into Posts is my free WordPress plugin that adds date shortcodes such as [year], [month] and [monthyear] to titles, content, excerpts and SEO fields. It has no settings page. You install it, and the shortcodes work.

Before You Start

You need 3 things in place:

  • Dynamic Month & Year into Posts 1.8.1 or newer, installed from Plugins → Add New Plugin by searching for its name.
  • The right site time zone under Settings → General → Timezone. Every date the plugin prints comes from that setting, so a site set to UTC flips to the new year at UTC midnight.
  • A plan for your page cache, if you run one. The plugin renders the year on the server, so a cached page keeps last year’s number until the cache is cleared.

Add the Year to a Title

The shortcode goes straight into the title field, the same way you’d type any other word.

  1. Open the post in the block editor.
  2. In the title, replace the hardcoded year with [year]. For example: Best Laptops for Students in [year].
  3. Open the post settings, find the URL slug and remove the year from it. WordPress builds the slug from the title, so the example above becomes best-laptops-for-students-in-year unless you change it. A slug like best-laptops-for-students is the one you want.
  4. Save or update the post.
A post title in the WordPress editor containing the year shortcode

The title on the page now reads “Best Laptops for Students in 2026”, and it changes to 2027 on January 1 without anyone touching the post.

Shortcode names are lowercase. [Year] with a capital Y stays as plain text, because WordPress matches shortcode names exactly.

Pick the Right Shortcode

[year] covers most titles, but a few others are useful in headlines:

ShortcodeShowsGood for
[year]2026“Best X in 2026”
[nyear]2027Planners and calendars for the coming year
[pyear]2025“What changed since 2025”
[monthyear]October 2026Monthly deal and coupon pages
[month]October“October Deals”

[year n=1] gives the same result as [nyear], and [year n=-1] the same as [pyear]. The n value can be any whole number, positive or negative.

The full list of 36 shortcodes, including seasons, weekdays and Black Friday dates, is in the shortcode reference.

Where the Year Shows Up

The plugin renders its shortcodes in these places:

  • The title on the page, through the_title and single_post_title.
  • The browser tab title on single posts and pages.
  • Excerpts, including excerpts WordPress generates from the content.
  • Archive titles on category, tag and date archives.
  • The RSS feed, because feed titles use the same title function.
  • The Posts screen in wp-admin, so the list reads “2026” instead of [year].
  • The REST API, in title.rendered. The title.raw value keeps [year], which is what the editor needs.
  • Elementor, Bricks and Contextual Related Posts, each through its own hook.

Search snippets and social shares use your SEO plugin’s title fields. How to Put Dynamic Dates in Rank Math or Yoast SEO Titles covers those.

Check It Works

Open the post on the front end. The title, the browser tab and the post list in wp-admin should all show the current year.

With WP-CLI on the server, these 2 commands confirm the plugin and its time zone:

wp dmyip shortcode "[year]"
wp dmyip test

The first prints the current year in your site’s time zone. The second runs a set of sample shortcodes and ends with “All representative shortcode checks passed.”

When the Title Shows the Shortcode

What you seeWhy it happensFix
[Year] or [YEAR] in the titleShortcode names are case sensitiveType [year] in lowercase
[year] in the theme’s title area onlyThe theme prints the raw title without the title filterAsk the theme author to use the_title(), or switch to the theme’s standard title template
[year] in a category or tag <title>Term names in the browser tab don’t pass through the archive title filterKeep the year out of category and tag names
[year] in search results or social sharesThe SEO plugin’s own title template is used thereAdd the shortcode to the SEO title as well
Last year’s number after January 1A page cache is serving an old copyPurge the page cache on January 1

What It Won’t Do

The plugin changes the words on the page and nothing else:

  • It doesn’t change the slug. WordPress keeps whatever slug you saved, which is why a year-free slug matters.
  • It doesn’t change the modified date. The post’s “last updated” date, the dateModified in your schema and the sitemap date all stay as they were.
  • It doesn’t refresh cached pages. Cached HTML holds the old year until your cache expires or you purge it.
  • It doesn’t update the content for you. A title that says 2026 over a list last checked in 2024 is a promise the page doesn’t keep.

That last point matters more than the other three. When Not to Use Dynamic Years explains where a dynamic year helps and where it hurts.

Share

Was this helpful?

Still stuck? Open a support ticket