• If a new post has the same post_name as another one, WordPress automatically appends it with -2, -3 etc.

    I there a way to add -1 at the end of a post if there isn’t one with the same name?

    I’ve tried altering various sections of posts.php but it I’m not sure what the relevant section is (or if that’s even the right file to be looking at).

Viewing 2 replies - 1 through 2 (of 2 total)
  • Open (edit) the post you want to change. Look directly under the title field, you will see Permalink: followed by the URL. Click the Edit button behind the link. Type in the new URL and click OK. Save the page or post.

    Thread Starter NathanielFisher

    (@nathanielfisher)

    I was looking for a way for it to be done automatically in the same way that it does when duplicate posts have the same name.

    I’m actually trying to add the $post_id to the start of all post_names (partly so I can remove the suffix at the end). So far I’ve got it working on ones where the post_name is a duplicate, but I need it for new posts, too.

    So instead of

    www.mysite/another-post
    www.mysite/another-post-2

    it will show

    www.mysite/118-another-post
    www.mysite/119-another-post
    www.mysite/120-a-different-post
    www.mysite/121-you-get-the-point

    Anyone know how to do this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How do I add the -1 suffix at the end of every post?’ is closed to new replies.