Support » Fixing WordPress » Changing post title does not alter permalinks…

  • Hi everyone,

    Been a long time since I’ve been on here! Unfortunately I now require someone’s knowledge…

    There is a website I am running on WordPress for a client, and part of the site requires news articles to be posted – therefore I have adapted the Post section of the wordpress admin for news articles by adding a meta box with extra options. However, should the client need to alter the title of the article for any reason, the permalinks do not update as the title is changed – I wondered if this is normal?

    For example:

    News article is created with title: “This is a news article”. My permalink structure would create “this-is-a-news-article.html”.

    Client comes back and changes title to “This is an edited news article”. However, the permalink remains as “this-is-a-news-article.html” when I would need to to change to “this-is-an-edited-news-article.html” in order for the links to work correctly on the front end.

    Anyone have any ideas or is there no way to do this without a plugin?


Viewing 5 replies - 1 through 5 (of 5 total)
  • While editing the article, delete the permalink. This is above the main content area in the editor. It will re-generate the permalink with the new title when the Save (or autosave) occurs.

    Just a heads up, but you may want to keep a close eye on these edits. If you automatically had the permalink change on every edit this could screw with backlinks from external sites or even pages that link internally within your site.

    @flamenco This may be a solution but the client who will be editing the posts will not actually see the titlediv as I have created a separate input in a metabox called “Article Title” which is mirrored in the title input using javascript. It may seem overkill but this is the way we need to do it as it needs to be really easy for the client and also un-wordpressy (if you see what I mean). Is there any way to auto delete the permalink?

    Great points from both of you! Auto delete… no idea. You’ll probably have to write code for it.

    eamethan, your link point is excellent, but if I recall, in some testing I seem to have seen the old link work anyway! Not sure if something is cached somewhere, or the “nearest thing” is grabbed, or what. Don’t quote me on this without testing, of course.

    Client-proofing sites is the bane of my existence lately. 🙂

    Cracked it! Managed to intercept the ajax call halfway through so it would force it to change – I found out if I click “Edit” on the permalink, then click Cancel, it WILL change upon changing the title – however, it won’t run the ajax if you don’t…so I made a function called “savepermalink” and whacked the ajax call in there with my own ajax file (passing the correct params). Probably overkill but it works now. I guess I could have stuck a database call to wp_posts to change the post_name once saved…but there you go.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Changing post title does not alter permalinks…’ is closed to new replies.