Allow Numeric Slugs

Allow Numeric Slugs

Alex Mills

Normally it is not possible to have a page slug (the page’s name in the URL) that is a number. For example this will not work: yoursite.com/about/2/. That URL conflicts with paged content feature where you can posts and pages with multiple pages of content by adding <!--nextpage--> within your content.

This plugin allows you to have pages with numbers as slugs by giving up the ability to have paged content pages which isn’t a big deal as most people don’t use paged content pages anyway.

Code contributions and bug reports are welcome via this plugin’s GitHub repository.

Works instantly without any configuration needed

By matthewdhenderson on July 25, 2023

You can't have a post with a numeric slug like "2020." Wordpress will automatically add a "-2" to the end of it. This plugin solves the problem instantly.
This developer passed on in 2019. I'm praying for his soul and the comfort of his family.

Bada55!

By ps3hero on April 27, 2022

Works perfect, THX a lot for this.

Works with 5.2.2

By Evan Norton (evannorton) on July 31, 2019

SSIA

Works with Wordpress 4.9.6

By xammm on June 18, 2018

FYI: Works with Wordpress 4.9.6

Beautiful plugin.

By nabillionaire on June 12, 2017

Works just as advertised. Love it! Thanks a lot.

Thank you!

By Dima Stefantsov on January 9, 2017

Your code solved my issue. Thanks!

What a relief!

By Tulimafat on September 3, 2016

This have been bugging me for soooo long. Finally a way to make pretty URLs. Before Wordpress just added a "-2", and the end, but now it's displayed as I wanted it.

Example:
Before: site.com/pictures/2016-2/
Now: site.com/pictures/2016/

Version 3.0.0

  • Ditch all of the old fragile hackery of this plugin in favor of just hooking into the WordPress function that ensures that slugs are unique. It’s what was adding the -2 suffix in the first place.

Version 2.2.0

  • Update for WordPress 4.4’s rewrite rules.
  • PHP 7 compatibility by renaming class constructor. Also drops unneeded references.

Version 2.1.0

  • Update for WordPress 3.3’s rewrite rules.

Version 2.0.1

  • Re-add the save_post filter after fixing the slug incase multiple posts are updated in one pageload.

Version 2.0.0

  • Recoded for WordPress 3.0+. WordPress now won’t let you manually enter a numeric slug — it will prefix “-2” onto the end of it so that the page is viewable. This new plugin version works around it.

Version 1.0.0

  • Initial release.
  1. Go to your admin area and select Plugins Add New from the menu.
  2. Search for “Allow Numeric Slugs”.
  3. Click install.
  4. Click activate.

Reviews

5 out of 5 stars

  • Version: 3.0.0
  • Last updated: 8 years ago
  • Active installations: 1K
  • WordPress version: 3.3
  • Tested up to: 4.4.33
  • PHP version: false