Insights
Why does WordPress append “-2” on newly created pages?
Jean-Nicolas GauthierLast updated:

WordPress enforces unique slugs. If a page, post, or taxonomy already uses the slug (or even if it’s sitting in the Trash), WordPress will create a new slug with “-2”, “-3”, etc. TranslatePress can also create translated slugs that collide, causing the same behavior in translated URLs.

Safe workflow (staging first!)
Create/refresh a staging environment. Never operate directly on production.
Back up the database. Always keep a rollback path.
Locate duplicates in the default language.
Run this query in phpMyAdmin (adjust
pageNameto your slug):SELECT * FROM wp_posts WHERE post_name LIKE 'pageName%';What to look for: An older entry using the clean slug (e.g.,
post_name = 'pageName') while your current page is stuck aspageName-2.Validate the result. Confirm the older item is truly unused (e.g., status is
trashor it’s an old draft you no longer need).Clean up duplicates. Delete the old/unused entry. If it’s in Trash, empty the Trash so the slug is freed.
Reset the slug from WordPress. In the WP admin, use Quick Edit (or the editor’s permalink field) to change
pageName-2back topageName. Save.Handle translated slugs (TranslatePress).
Search in the TranslatePress slug table for collisions:
SELECT * FROM wp_trp_slug_translations WHERE translated LIKE '%pageName%';If a translated slug duplicates an existing one (causing
-2), remove or adjust the conflicting entry, then set the correct translated slug via TranslatePress (front-end editor or Slugs screen).Refresh permalinks. Go to Settings → Permalinks and click Save Changes to flush rewrite rules.
Test thoroughly on staging. Verify all language versions load correctly and that redirects/canonical tags behave as expected.
Deploy to production. Repeat the exact steps, then re-test.
Pro tips
Also check taxonomies (categories/tags/custom taxonomies). They can hold the same slug and force “-2” on pages/posts.
Keep slugs accent-free in French (e.g.,
observabiliteinstead ofobservabilité) for clean URLs.In TranslatePress settings, consider disabling automatic slug translation and managing translated slugs manually to avoid collisions.
Sources & References
wp_unique_post_slug() - WordPress Developer Reference
developer.wordpress.orgWordPress Database Description - Codex
codex.wordpress.orgTranslatePress Documentation
translatepress.comFiltering wp_unique_post_slug - WordPress VIP Docs
docs.wpvip.com

