Article

Why does WordPress append “-2” on newly created pages?

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.

Sengo Article Default Thumbnail

Safe workflow (staging first!)

  1. Create/refresh a staging environment. Never operate directly on production.
  2. Back up the database. Always keep a rollback path.
  3. Locate duplicates in the default language.

    Run this query in phpMyAdmin (adjust pageName to 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 as pageName-2.

  4. Validate the result. Confirm the older item is truly unused (e.g., status is trash or it’s an old draft you no longer need).
  5. Clean up duplicates. Delete the old/unused entry. If it’s in Trash, empty the Trash so the slug is freed.
  6. Reset the slug from WordPress. In the WP admin, use Quick Edit (or the editor’s permalink field) to change pageName-2 back to pageName. Save.
  7. 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).

  8. Refresh permalinks. Go to Settings → Permalinks and click Save Changes to flush rewrite rules.
  9. Test thoroughly on staging. Verify all language versions load correctly and that redirects/canonical tags behave as expected.
  10. 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., observabilite instead of observabilité) for clean URLs.
  • In TranslatePress settings, consider disabling automatic slug translation and managing translated slugs manually to avoid collisions.
Sengo Robot  Nikko