Support » Fixing WordPress » Can’t have a post_name with just numbers?

  • I’m trying to create pages that have post_name set to just a number, like “123456”. When you visit those pages –, for example – the page cannot be found. If you change the post_name to include a letter –, for example – the page appears. Any idea how I can get around this? My permalinks for the posts use the post ID, if that makes a difference.


Viewing 8 replies - 1 through 8 (of 8 total)
  • Under Permalinks/Custom structure this works for me: /%post_id% and this also /%post_id%/

    You did do the .htaccess thing offcourse because a123456 works?

    I have an htaccess file that I’ve been using, and post_id is set as the permalink. I don’t know why for the pages, it only works if post_name does not only contain numbers.

    Just gave it a try out in wp 2.9.1. and I can confirm the behaviour. A new page with a name and page-slug consisting of only numbers gives a not found. So page name and slug 123 did not work where as a123 does work.
    Must be a WP internal thing+ maybe worth a bug report.

    Problem doesn’t exist in 3.0, so you’re proberly wasting your time with the bug report as it’s clearly been fixed for 3.0..

    I created 2 new pages to test, one called 123456, and another called 7890, both worked fine, the permalinks were as follows…


    However i do have a slight difference in my permalink settings, i use..


    Yep, when I change to /%postname%/ it works but I prefer my permalinks to start with a numerical item to keep up the speed.

    /%post_id%/ does NOT work and /%post_id%/%postname% does also not work

    Qoute: “For performance reasons, it is not a good idea to start your permalink structure with the category, tag, author, or postname fields. The reason is that these are text fields, and using them at the beginning of your permalink structure it takes more time for WordPress to distinguish your Post URLs from Page URLs (which always use the text “page slug” as the URL), and to compensate, WordPress stores a lot of extra information in its database (so much that sites with lots of Pages have experienced difficulties). So, it is best to start your permalink structure with a numeric field, such as the year or post ID.”

    from here:

    Ok a little off-topic but..

    Any site with a large number of pages is going to suffer performance issues vs one with few pages anyway, pages each have an array of several rules, post’s use a more “one for all” approach in a manner of speaking.. so require less rules to manage them all… ( i use very few pages )..

    Print out the rewrite rules array and look at what’s there, you’ll find a much larger assortment of rules for pages..

    I’m sure not about the numeric problem in any case…

    Does the post/page save with the numeric value and load the correct url? (even if an error message is shown)..

    It saves and in the dashboard it shows the postnumber (4856) for my test page.
    In the dashboard it shows as page_id=4856

    So when I set the permalinks to default, I can call the page through: and offcourse not through ../123

    Now when I set the permalinks to /%post_id%/ ../123 is a no go and gives an error BUT the address bar switches to ../123 (funny)

    And when I set the permalinks to /%page_id%/ everything works fine and I can call the page through and also through and then the browsers address bar switches to ../123

    Note 1: /%page_id%/ is not in the list here:

    Note 2: I did not test for internal broken links but it seems to work.

    I’d have thought using post_id would fail for pages, and vice versa for posts (page_id).. i’d say that’s behaviour i’d expect, but then i’m not immediately familiar with the inner workings of the rewrite class to comment defintively on the matter..

    An alternative might be to use a more common permalink setting, and then write your own custom rule(s) for particular/special pages that need to be handled a certain way..

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Can’t have a post_name with just numbers?’ is closed to new replies.