How to make permalink variable %year% two digits instead of four digits?

In Settings > Permalinks, I’m interested in changing the current tag %year% so it becomes two digits instead of four. For example, if I used %year% in the custom structure field, the URL would be 22 instead of 2022.

Alternatively, being able to add a new tag called %year2% that displays the year in double digits would be acceptable.

Are there plugins for this? Or do I have to go into the WordPress code and add custom code or replace the existing code? Do I have to review this change with every WordPress upgrade?

Leave a Comment