Better Search Replace plugin

  1. Better Search Replace will assist with changing URLs or slugs etc in your database.
  2. It is also very helpful when changing your site from HTTP to HTTPS.

Changing slugs that have -1 appended

  1. Sometimes when you add a new location or category etc, the slug [part URL] might get a “-1” appended. For example mysite.com/location/east-sussex-1/
  2. This happens because WP does not allow duplicate slugs, and there already is something else using the slug east-sussex.
  3. This can be a tag, or a post name etc.
  4. It can also still be in the database from an old plugin you deleted.
  5. The solution is to search the database for the slug east-sussex and change it to east-sussex-2
  6. Then search for east-sussex-1 and replace all results (except the one you just changed) with east-sussex.

First replace the “correct” slug in the database

  1. Go to your database using phpMyAdmin.
  2. Search for the “correct” slug and replace it if required.
  3. Go to the Search:
  4. Search for east-sussex:
  5. Review the results:
  6. Adjust if you like by double clicking the field and changing the slug:

Using Better Search Replace

  1. After installing the Better Search Replace plugin, go to Tools > Better Search Replace:
  2. Let’s now search for the slug that we want to replace:
  3. You can now review where the slugs will be replaced:
  4. If all is OK, run the process, but un-tick the “Run as dry run” box.
  5. Once that is done, re-save WP Settings > Permalinks.