WordPress not opening posts with only numbers if permalink is post_name

Someone knows why this happens?

For instance, I have a post called 1987, but it does not open it when I click on the link. When I use a different permalink structure, it opens it. Why is this and how can I solve this?

Read More

FYI: I don’t get a 404 error, I just get a Firefox error where it says: this page is not redirecting it well

Related posts

2 comments

  1. Sorry I didn’t follow up on this. You mentioned you weren’t using date archives. You can change the date archive structure to remove the conflict with /%postname%/:

    function wpa_change_date_structure(){
        global $wp_rewrite;
        $wp_rewrite->date_structure = 'date/%year%/%monthnum%/%day%';
    }
    add_action( 'init', 'wpa_change_date_structure' );
    

    So now after permalinks are flushed, date archive URLs will be prefixed with date/, so numeric postnames will no longer match the date rewrite rule.

  2. You can solve this by updating the post’s slug to something besides a number. Other than that, I haven’t found a solution (while still keeping post-name as the permalink).

Comments are closed.