When I add a link in a Widget, I get the standard Insert/edit link dialog with a Search field.

If I enter the Page in the Search field and then link to this page using the "Or link to existing content" it generates an absolute URL.

The problem with this is that if you then end up changing the URL to the Page (e.g. if you change its Parent Page) then the URL changes and we get a 404.

Any suggestions on how you can link to the Page so that you don't get broken links?

What I'm looking for ideally is something like a link_to_page() function.

1 Answer 1


Perhaps this approach will work for you. I like to use PHP Code Widget, which is like a regular Text widget, but one that allows you to use Wordpress functions and other PHP in the body. Once you install that widget you could then use one of the Wordpress functions like get_page_link() or get_permalink() to dynamically retrieve the page link that you are interested in linking to.

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.