• When I set some pages as “Parent” (implicitly making others “Child” pages), WP seems to blow away internal links.

    To demonstrate I have created two pages, “Page 1” (page-1) and “Page 2” (page-2).

    1) page-1 has Parent set to “Main (no parent)”.

    2) page-2 has Parent set to page-1. page-2 content body contains a link to page-1 (edited using the HTML editor). That link looks like this:

    <a href="page-1">Go to Page 1</a>

    Problem:

    When I hover over that link (“Go to Page 1”) in Page 2, the address it shows in the browser status bar is bizarre (and is displayed with strikethrough – seemingly – and accurately – indicating that it is a broken link):

    https://example.com/wpsandbox/page-1/page-2/page-1

    I get a “404/Page Not Found” error when I click the link.

    When I remove the parent/child relationship (both page 1 and page 2 have no parents), the link works.

    The site I am working on is a migration from a proprietary platform. I have some 200 html files whose body content I pasted into WP pages using the code editor. These files have extensive internal linking. WP seems to put this code into “Custom HTML” block. The nature of my challenge makes it such that manually editing each and every link impractical.

    Is the parent/child functionality in WP just a thing to avoid in my context? Or maybe there’s some way to get WP to use my links “as is”?

    Thanks for any suggestions!

Viewing 1 replies (of 1 total)
  • If you’re on PAGE 2 with the URL: example.com/sandbox/page-1/page-2/

    … and you create a link with the relative URL page-1

    This relative URL resolves to example.com/sandbox/page-1/page-2/page-1.

    This is the root of your problem, and why You’re getting the 404.

    Note that this is just how HTML works: it has nothing to do with WordPress or the parent-child relationship.

    To resolve all the way to the root, you should use /page-1 instead. Note the leading forward slash. And to resolve to the “sandbox” directory, use /sandbox/page-1. Or use absolute URLs just to be safe.

Viewing 1 replies (of 1 total)
  • The topic ‘Broken internal links to parent page from child pages’ is closed to new replies.