Skip Navigation

[Resolved] Editing body copy URLs to be / instead of hard URLs

This support ticket is created 2 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 6 replies, has 2 voices.

Last updated by Waqar 2 years, 5 months ago.

Assisted by: Waqar.

Author
Posts
#2203061

Tell us what you are trying to do?
When a copying prod site to staging, there are prod URLs in the body copy. How to make it / instead of prod URLs so that when testing in Staging we can do so in there instead of the URL when clicked goes back to Prod in the body copy? Where do we edit this in Toolset?

Is there any documentation that you are following?
This site was set up previously and I am trying to understand where to make these edits of the URLS in the body copy that is developed in Toolset.

Is there a similar example that we can see?

What is the link to your site?
hidden link
If you look on the body copy of all pages, all those links when you hover over or click on, it takes you to the prod site which should not be happening in Staging. The URLs should say staging.floodsciencenter.org so we can test pages within Staging. Where do we go to edit this?

#2203161

I have ran Better Search and Replay for hidden link changed to hidden link so that those links are correct for Staging environment. If we pushed this back to Prod, we would have to use Better Search and Replace to change it again without "staging." in the url. Is there a way to make Toolset/custom posts have relative paths instead of absolute paths? Please advise.

#2204615

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting us and I'd be happy to assist.

I'm not sure what method or tool you're using to move the content between staging and production environments, but, most backup/restore, and/or migration plugins, automatically take care of URL replacements, with respect to the new location.

These are the plugins that we recommend:
1. Duplicator – WordPress Migration Plugin
2. All-in-One WP Migration

If you're using the manual migration method or your migration tool doesn't support the automatic replacements, then yes, you'll have to apply manual search and replace, each time the changes are moved across the environments.

regards,
Waqar

#2204971

Hello,

Yes, I am using All in One migration, my question is that in the body copy moving forward, I want to correct the manual URLs from absolute to relative path urls, so that I do not have to do the search and replace each time we migrate changes. I need to understand and figure out how to edit our existing Toolset data that was previously set up prior to me coming on to manage the website. Can you guide me where I can find how we edit these URLs with Toolset to change from absolute to relative paths hidden link to just /pagename urls when we edit the body content and applying the URLs on a link text.

#2208607

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for waiting.

Some of the places where you can find the absolute URLs are:

1. Post content/body
2. Custom fields where the URL of internal or external pages, Images, or files have been used.
3. Content saved in the widget areas.
4. WordPress settings/options table, where active theme and all active plugins (and not just Toolset) may have saved absolute URLs. The URLs in the database table can often be in a serialized form too.

As for the Toolset's audio, embedded media, file, image, and URL type custom fields, storing the relative path URLs won't work, as they expect the absolute URLs.

So, in short, for safer migration, relying on the use of relative paths won't be enough and you'll have to incorporate some sort of "search & replace" in your workflow, when working with a website with separate staging and production environments.

Additional tip: In your content/body and widget areas ( or anywhere where you have to add manual links), a better alternative to using relative paths is the use of Toolset shortcodes, to dynamically generate the URLs.

For example, to add a homepage link, you can use the "wpv-bloginfo" shortcode:
( ref: https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-bloginfo )


<a href="[wpv-bloginfo show='url']">Home</a>

Likewise, to show a link to the website's "Contact Us" page, with ID "5", you can use the "wpv-post-url" shortcode:
( ref: https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-url )


<a href="[wpv-post-url item='2']">Contact Us</a>

I hope this helps.

#2210033

Great tips, thank you! I will look into that documentation link on url shortcodes.

#2211643

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thanks for the update and glad I could help.

Let me know if you have any follow-up questions and for a new question or concern, you're welcome to start a new ticket.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.