• Resolved big_s

    (@big_s)


    I have a single post that I published then deleted.

    This post was called ‘post-list’.

    If I delete this post, and ensure deleted from trash too, and then try to recreate the post with the same post name the new permalink for the post is generated automatically as ‘post-list-2’.

    I don’t want a permalink of ‘post-list-2’, I want ‘post-list’.

    I have tried editing the post permalink on the edit post page, tried editing the slug on the post quick edit, and tried using several database clean up plugins to optimise and clean the database before trying to recreate the post but nothing works.

    Any advice please anyone?

Viewing 4 replies - 1 through 4 (of 4 total)
  • If you have a post-list-2, then there is a post_name somewhere in the database with post-list on it, resulting in the additional record being created. Though there are ways around it, that requires programming (and is probably not suggested).

    I just tested on my own installation, using version 3.9.1, and didn’t have the same problem as you are seeing, so either you have another version that may have an issue with this (leaving remnants of some sort behind in the database), or the software version is okay, but there is something left in the database that needs cleaning.

    The simplest way to resolve the problem would be to try a tool from your host, such as phpMyAdmin, and see if there is anything in the wp_posts table (the table prefix may differ on your installation). You can either manually look at the post_name column, or search it if you have a number of records. If you have something in there, it will help determine why you are getting another record created.

    Thread Starter big_s

    (@big_s)

    Hi, thanks for taking time to look at this.

    Definitely running 3.9.1. Programming solutions are fine but just an unexpected necessity. This seems such a trivially simple thing to want to do. I am surprised the WP database doesn’t get tidied up enough after a page has been deleted so that you are able to create a new page with the same permalink after.

    Sure I could start running queries on the DB but surely a plugin like WP Optimize or WP Clean Up should remove any extraneous posts and associated meta for me. Do I really have to get my hands that dirty to solve this? – I have 150+ sites to do this on and so the more complex the solution the more of a real pain this becomes.

    Any other ideas?

    The uniqueness is fairly well ingrained into the core, and there are a few discussions out there on this, going back a few years (both here and elsewhere).

    The issue is that there’s a record somewhere that causes the software to think it needs to increment the slug, so finding it is the only solution.

    It would indeed be nice if a plugin removed that data, but if the data is either still in use (for whatever reason) or orphaned so that it can’t be found, then they can’t find it, and it won’t be removed – looking for it manually is going to be the only option.

    I did see a discussion how it may also be in wp_terms (under slug), so you might want to look there too, if you decide to look. This would be a category record.

    And if you’re interested in reading more detail, this is an interesting conversation on the subject.

    Thread Starter big_s

    (@big_s)

    Hi jayseae,

    Some manual queries on the back end identified and solved the issue. The problem was that another page with the same slug had been created however this page was also flagged as the landing page in settings. The permalink of this page was therefore automatically changed by WP to only the domain rather than domain + page slug based permalink so wasn’t obvious in wp-admin.

    Thanks anyway.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Change Permalink of Single Post to Original’ is closed to new replies.