WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Relative linking works in page custom fields, but not sub page custom fields (5 posts)

  1. hrcwebmaster
    Member
    Posted 1 year ago #

    I am creating a CMS, and with it 42 pages that will require custom fields, and beneath those, 4 sub-pages EACH. I am creating the site on a development site and will move the site to a different domain when the site is ready to go live.
    I have created two "parent" pages and their four sub-pages (or "children"). Within the custom fields of the parent pages, I inserted relative links to images in my media library (ex: <img src="../wp-content/uploads/2012/08/myphotos.png" />). The images from all of the custom fields appear on the parent page just fine. But when I go to copy the same relative links on to the children/sub-pages, the images do not appear on those sub-pages.
    I have seen other forum discussions, but nearly all solve the problem with php code, which I cannot insert into the custom fields.
    It is very important I use relative links in my custom fields so I don't have to go back and re-type all of the image locations AFTER my site has gone live!
    Please help, I feel like I'm missing something obvious or perhaps there's an easy plugin for this (though I'd prefer to not solve everything with a plugin).
    Thank you!!

  2. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    Never use relative links in WordPress. As you have found out, they can behave unpredictably - if at all. Always use full (absolute) urls.

  3. hrcwebmaster
    Member
    Posted 1 year ago #

    So I have to replace each and every custom field with a link within WordPress after my site goes live? That's nearly 1,000 links I'll have to go back and replace!

  4. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

  5. hrcwebmaster
    Member
    Posted 1 year ago #

    Ok I'll try that, thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic