Ugly permalinks
-
Hello,
I use the Yoast Duplicate Post plugin on a site where editors publish new posts by cloning earlier posts: new information about the same subject, with the same post layout and even, partly, the same post contents. People do this by taking the most recent post about that subject, cloning it and then editing and publishing the clone.
The site uses “pretty permalinks”, so the page/post URLs are like
https://this.site/some-post/
. Obviously an original post and its clones need to have different permalinks. Yoast Duplicate Post does not offer a feature to rename the permalink when it creates a clone (correct?) but leaves that to WordPress core. Unfortunately this results in…- original post:
https://this.site/some-post/
- clone:
https://this.site/some-post-2/
- clone of clone:
https://this.site/some-post-2-2/
- clone of clone of clone:
https://this.site/some-post-2-2-2/
- etc.
I have seen URLs ending with
-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2/
.This is not nice – and definitely undesirable from an SEO point of view, I guess.
So I put a few lines of code in my theme’s
functions.php
file to deal with this, using thedp_duplicate_post
hook from your developer documentation, producing:- original post:
https://this.site/some-post/
- clone:
https://this.site/some-post-2/
- clone of clone:
https://this.site/some-post-3/
- clone of clone of clone:
https://this.site/some-post-4/
- etc.
Of course it would be much nicer if your plugin would handle this itself.
Best regards!
- original post:
- The topic ‘Ugly permalinks’ is closed to new replies.