3

I'm working on a site which has some incorrect permalinks contains 'home-2' e.g. http://example.com/home-2/pagetitle/. I have no way of knowing where home-2 came from and manually editing the permalink in the page editor only allows me to edit the pagetitle portion.

This question seems relevant but refers to the post title and not the portion of the URL I need to change.

So how might this home-2 situation have occurred. Perhaps a category or parent page? There are no posts or pages in the trash with that name. And how can I remove it without using a plugin such as this to reset the permalinks?

UPDATE

There is a wp_posts record in the database for the page with title 'Home' which has the post_name field set to 'home-2'.

2 Answers 2

5

Simply visiting the permalinks page in wp-admin will reset the permalinks. On that page you also have options which permalinks you want. Check if the home-2/ bit is not prepended there.

Then ofcourse, the obvious is checking that the page 'pagetitle' is not a child of the page 'home-2'. Check your trash for existing pages (but you've already done that).

Do all links have this home-2/ prepended? Or is it only the case on a few pages?

1
  • Thanks :) It's only a few pages but I'd like to understand what is going on rather than recreate the pages. 'Home-2' does not appear on the permalinks settings page and the page 'pagetitle' is a child of 'Home' but NOT 'Home-2'
    – codecowboy
    Commented Dec 12, 2014 at 11:52
0

Is this page a child of another page? If so, you can edit the URL of the parent page.

Note: 99% of the time when I see a "something-2" it's because "something" was already created by another page/post/etc. If you can't find it, check the trash - until you delete it from the trash, WP won't let you use that URL on another page/post/etc.

4
  • Just saw your comment about the page being a child of "Home" - double-check that the URL of Home isn't "home-2". If it is, change it. If it's not, you may need to edit the child page and choose "Home" from the parent drop-down again. Commented Dec 12, 2014 at 18:21
  • The Url of Home is not home-2. If I edit a child page and choose Home again, the permalink reverts to home-2. Where is Wordpress generating this 'home-2' if there are no longer two pages called 'home'?
    – codecowboy
    Commented Dec 23, 2014 at 7:50
  • see also update in question. If a page has a parent, is there any way to remove the parent page name from the permalink entirely?
    – codecowboy
    Commented Dec 23, 2014 at 8:07
  • not to forget an other classic, slug associated to media. On editing media top right corner in options you can chose to display/edit it's slug. If you had an image 'home.jpg' uploaded, it'll take the slug 'home' Commented Mar 6, 2022 at 3:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.