I run a news site and there’s a WordPress permalink issue that I have been wondering. Now, WordPress will add an incremental numeric suffix to duplicate %postname% regardless of the directory structure.
For example, wordpress will add a “-2” suffix to the permalink regardless if the structure is domain.com/2016/04/03/news-title
or domain.com/category/news-title-%post_id%
when it detects a duplicate.
I initially believe that WordPress would not add the suffix automatically after appending a %post-id% to the end of the permalink but that is not the case.
What I’m trying to achieve (without WordPress meddling with the %postname%) is the following:
- domain.com/2016/04/03/news-title-44956 (assuming the numbers behind is the %post_id)
- domain.com/2017/05/06/news-title-55957
or
- domain.com/2016/04/03/44956/news-title
- domain.com/2017/05/06/55957/news-title
I hate the idea that I won’t be able to use the same title with a different content a year later (or many years later) even though the permalink directory is vastly different by then.
Is there any way I can add hooks or temporarily modifying the WordPress core to fix this or at least get WordPress to automatically append the %post-id% instead of an incremental number when it detects a duplicate permalink?