As you probably know, if a new post has the same post_name as another one, WordPress automatically appends it with -2, -3 etc.
But is there any 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).
What I'm actually trying to do is add the $post_id to the start of all post_names which are written to the database (mainly 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
www.mysite/a-different-post
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?